WordPress at a glance

get_template_directory_uri() WP 1.0

Retrieve theme directory URI.

Is the basis for: get_theme_file_uri()
✈ 1 time = 0.002132s = very slow | 50000 times = 3.37s = fast PHP 7.1.2, WP 4.7.3
Hooks from function:
Return

String. Template directory URI.

Usage

get_template_directory_uri();

Code of get_template_directory_uri: wp-includes/theme.php VER 4.9.8

<?php
function get_template_directory_uri() {
	$template = str_replace( '%2F', '/', rawurlencode( get_template() ) );
	$theme_root_uri = get_theme_root_uri( $template );
	$template_dir_uri = "$theme_root_uri/$template";

	/**
	 * Filters the current theme directory URI.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir_uri The URI of the current theme directory.
	 * @param string $template         Directory name of the current theme.
	 * @param string $theme_root_uri   The themes root URI.
	 */
	return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
}

Related Functions

From tag: theme path (theme folder url)

More from category: Theme files connection

No comments
    Hello, !     Log In . Register