get_template_directory_uri

Retrieve theme directory URI.

Description

(string) get_template_directory_uri(); 

Returns (string)

Template directory URI.


Usage

  1. if ( !function_exists( 'get_template_directory_uri' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_template_directory_uri(); 
  7.  

Defined (1)

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

/wp-includes/theme.php  
  1. function get_template_directory_uri() { 
  2. $template = str_replace( '%2F', '/', rawurlencode( get_template() ) ); 
  3. $theme_root_uri = get_theme_root_uri( $template ); 
  4. $template_dir_uri = "$theme_root_uri/$template"; 
  5.  
  6. /** 
  7. * Filters the current theme directory URI. 
  8. * @since 1.5.0 
  9. * @param string $template_dir_uri The URI of the current theme directory. 
  10. * @param string $template Directory name of the current theme. 
  11. * @param string $theme_root_uri The themes root URI. 
  12. */ 
  13. return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );