get_template_directory_uri(): string
- Since
- 1.5.0
- Source
wp-includes/theme.php:361
Retrieves template directory URI for the active theme.
Return
string- URI to active theme's template directory.
Hooks fired · 1
One hook fires while get_template_directory_uri() runs, in this order:
- apply_filters( template_directory_uri )filterline 375 (+14 into the body)
Filters the active theme directory URI.
Uses · 3
- get_template()Retrieves name of the active theme.
- get_theme_root_uri()Retrieves URI for themes directory.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 50
- Custom_Image_Header::get_default_header_images()Gets the details of default header images if defined.
- Custom_Image_Header::process_default_headers()Processes the default headers.
- Custom_Image_Header::reset_header_image()Resets a header image to the default image for the theme.
- Custom_Image_Header::step_1()Displays first step of custom header image page.
- Featured_Content::enqueue_scripts()Enqueue the tag suggestion script.
- Twenty_Twenty_One_Dark_Mode::customize_controls_enqueue_scripts()Enqueues scripts for the customizer.
- Twenty_Twenty_One_Dark_Mode::editor_custom_color_variables()Enqueues editor custom color variables & scripts.
- Twenty_Twenty_One_Dark_Mode::enqueue_scripts()Enqueues scripts and styles.
- WP_Customize_Manager::register_controls()Registers some default controls.
- WP_REST_Themes_Controller::prepare_item_for_response()Prepares a single theme output for response.
- WP_URL_Pattern_Prefixer::get_default_contexts()Returns the default contexts used by the class.
- _get_random_header_data()Gets random header image data from registered images in theme.
Show all 50
- get_bloginfo()Retrieves information about the current site.
- get_custom_header()Gets the header image data.
- get_editor_stylesheets()Retrieves any registered editor stylesheet URLs.
- get_parent_theme_file_uri()Retrieves the URL of a file in the parent theme.
- get_theme_file_uri()Retrieves the URL of a file in the theme.
- get_theme_mod()Retrieves theme modification value for the active theme.
- twenty_twenty_one_get_starter_content()Function to return the array of starter content for the theme.
- twenty_twenty_one_register_block_pattern()Register Block Pattern.
- twenty_twenty_one_scripts()Enqueues scripts and styles.
- twentyeleven_admin_enqueue_scripts()Properly enqueue styles and scripts for our theme options page.
- twentyeleven_block_editor_styles()Enqueue styles for the block-based editor.
- twentyeleven_color_schemes()Return an array of color schemes registered for Twenty Eleven.
- twentyeleven_customize_preview_js()Bind JS handlers to make Customizer preview reload changes asynchronously.
- twentyeleven_enqueue_color_scheme()Enqueue the styles for the current color scheme.
- twentyeleven_layouts()Return an array of layout options registered for Twenty Eleven.
- twentyeleven_scripts_styles()Enqueue scripts and styles for front end.
- twentyfifteen_block_editor_styles()Enqueue styles for the block-based editor.
- twentyfifteen_customize_control_js()Binds JS listener to make Customizer color_scheme control.
- twentyfifteen_customize_preview_js()Binds JS handlers to make the Customizer preview reload changes asynchronously.
- twentyfifteen_fonts_url()Register fonts for Twenty Fifteen.
- twentyfifteen_scripts()Enqueue scripts and styles.
- twentyfifteen_setup()Sets up theme defaults and registers support for various WordPress features.
- twentyfourteen_admin_fonts()Enqueue font stylesheet to admin screen for custom header display.
- twentyfourteen_block_editor_styles()Enqueue styles for the block-based editor.
- twentyfourteen_customize_preview_js()Bind JS handlers to make Customizer preview reload changes asynchronously.
- twentyfourteen_font_url()Register Lato font for Twenty Fourteen.
- twentyfourteen_scripts()Enqueue scripts and styles for the front end.
- twentyfourteen_setup()Twenty Fourteen setup.
- twentynineteen_scripts()Enqueue scripts and styles.
- twentyseventeen_block_editor_styles()Enqueues styles for the block-based editor.
- twentyseventeen_fonts_url()Register custom fonts.
- twentyseventeen_scripts()Enqueues scripts and styles.
- twentyseventeen_setup()Sets up theme defaults and registers support for various WordPress features.
- twentysixteen_block_editor_styles()Enqueue styles for the block-based editor.
- twentysixteen_customize_control_js()Binds the JS listener to make Customizer color_scheme control.
- twentysixteen_customize_preview_js()Binds JS handlers to make the Customizer preview reload changes asynchronously.
- twentysixteen_fonts_url()Register fonts for Twenty Sixteen.
- twentysixteen_scripts()Enqueues scripts and styles.
Source
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 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. */ return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );}History
Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.