On this page
get_template(): string
Retrieves name of the active theme.
Return
string Template name.
More Information
This function retrieves the directory name of the current theme, without the trailing slash. In the case a child theme is being used, the directory name of the parent theme will be returned. Use get_stylesheet() to get the directory name of the child theme.
Source
File: wp-includes/theme.php. View all references
function get_template() {
/**
* Filters the name of the active theme.
*
* @since 1.5.0
*
* @param string $template active theme's directory name.
*/
return apply_filters( 'template', get_option( 'template' ) );
}
Hooks
- apply_filters( 'template',
string $template ) -
Filters the name of the active theme.
Related
Uses
| Uses | Description |
|---|---|
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| _register_theme_block_patterns() wp-includes/block-patterns.php | Register any patterns that the active theme may provide under its |
| _get_block_template_file() wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| _get_block_templates_files() wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
| resolve_block_template() wp-includes/block-template.php | Returns the correct ‘wp_template’ to render for the request template type. |
| WP_Debug_Data::debug_data() wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| is_theme_paused() wp-admin/includes/theme.php | Determines whether a theme is technically active but was paused while loading. |
| wp_edit_theme_plugin_file() wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| Theme_Upgrader::bulk_upgrade() wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
| get_template_directory() wp-includes/theme.php | Retrieves template directory path for the active theme. |
| get_template_directory_uri() wp-includes/theme.php | Retrieves template directory URI for the active theme. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_template