template_directory_uri

Filters the current theme directory URI.

Description

apply_filters( 'template_directory_uri', (string) $template_dir_uri, (string) $template, (string) $theme_root_uri ); 

Parameters (3)

0. $template_dir_uri (string)
The URI of the current theme directory.
1. $template (string)
Directory name of the current theme.
2. $theme_root_uri (string)
The themes root URI.

Usage

To run the hook, copy the example below.
  1. $template_dir_uri = apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); 
  2.  
  3. if ( !empty( $template_dir_uri ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the template_directory_uri callback 
  2. function filter_template_directory_uri( $template_dir_uri, $template, $theme_root_uri ) { 
  3. // make filter magic happen here... 
  4. return $template_dir_uri
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'template_directory_uri', 'filter_template_directory_uri', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'template_directory_uri', 'filter_template_directory_uri', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/theme.php  
  1. return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );