Filter hook 'template_directory_uri'

in WP Core File wp-includes/theme.php at line 375

View Source

template_directory_uri

Filter Hook
Description
Filters the active theme directory URI.

Hook Information

File Location wp-includes/theme.php View on GitHub
Hook Type Filter
Line Number 375

Hook Parameters

Type Name Description
string $template_dir_uri The URI of the active theme directory.
string $template Directory name of the active theme.
string $theme_root_uri The themes root URI.

Usage Examples

Basic Usage
<?php
// Hook into template_directory_uri
add_filter('template_directory_uri', 'my_custom_filter', 10, 3);

function my_custom_filter($template_dir_uri, $template, $theme_root_uri) {
    // Your custom filtering logic here
    return $template_dir_uri;
}

Source Code Context

wp-includes/theme.php:375 - How this hook is used in WordPress core
<?php
 370  	 *
 371  	 * @param string $template_dir_uri The URI of the active theme directory.
 372  	 * @param string $template         Directory name of the active theme.
 373  	 * @param string $theme_root_uri   The themes root URI.
 374  	 */
 375  	return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
 376  }
 377  
 378  /**
 379   * Retrieves theme roots.
 380   *

PHP Documentation

<?php
/**
	 * Filters the active theme directory URI.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir_uri The URI of the active theme directory.
	 * @param string $template         Directory name of the active theme.
	 * @param string $theme_root_uri   The themes root URI.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/theme.php
Related Hooks

Related hooks will be displayed here in future updates.