WP_Debug_Data::get_wp_active_theme()wp-admin/includes/class-wp-debug-data.php |
Gets the WordPress active theme section of the debug data.
|
WP_Debug_Data::get_wp_parent_theme()wp-admin/includes/class-wp-debug-data.php |
Gets the WordPress parent theme section of the debug data.
|
WP_Debug_Data::get_wp_themes_inactive()wp-admin/includes/class-wp-debug-data.php |
Gets the WordPress inactive themes section of the debug data.
|
WP_REST_Templates_Controller::get_wp_templates_author_text_field()wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php |
Returns a human readable text for the author of the template.
|
wp_get_theme_preview_path()wp-includes/theme-previews.php |
Filters the blog option to return the path for the previewed theme.
|
_register_theme_block_patterns()wp-includes/block-patterns.php |
Register any patterns that the active theme may provide under its ./patterns/ directory.
|
WP_Theme_JSON_Resolver::get_style_variations()wp-includes/class-wp-theme-json-resolver.php |
Returns the style variations defined by the theme.
|
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles()wp-includes/class-wp-theme-json-resolver.php |
Returns the custom post type that contains the user’s origin config for the active theme or an empty array if none are found.
|
WP_Theme_JSON_Resolver::get_user_data()wp-includes/class-wp-theme-json-resolver.php |
Returns the user’s origin config.
|
WP_Theme_JSON_Resolver::get_user_global_styles_post_id()wp-includes/class-wp-theme-json-resolver.php |
Returns the ID of the custom post type that stores user data.
|
wp_is_block_theme()wp-includes/theme.php |
Returns whether the active theme is a block-based theme or not.
|
get_block_theme_folders()wp-includes/block-template-utils.php |
For backward compatibility reasons, block themes might be using block-templates or block-template-parts, this function ensures we fallback to these folders properly.
|
WP_Theme_JSON_Resolver::get_theme_data()wp-includes/class-wp-theme-json-resolver.php |
Returns the theme’s data.
|
WP_REST_Server::add_active_theme_link_to_index()wp-includes/rest-api/class-wp-rest-server.php |
Adds a link to the active theme for users who have proper permissions.
|
WP_REST_Themes_Controller::get_item_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Checks if a given request has access to read the theme.
|
WP_REST_Themes_Controller::get_item()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Retrieves a single theme.
|
WP_REST_Themes_Controller::prepare_links()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Prepares links for the request.
|
validate_theme_requirements()wp-includes/theme.php |
Validates the theme requirements for WordPress version and PHP version.
|
WP_Recovery_Mode_Email_Service::get_debug()wp-includes/class-wp-recovery-mode-email-service.php |
Return debug information in an easy to manipulate format.
|
WP_Recovery_Mode_Email_Service::get_cause()wp-includes/class-wp-recovery-mode-email-service.php |
Gets the description indicating the possible cause for the error.
|
WP_Site_Health::get_test_theme_version()wp-admin/includes/class-wp-site-health.php |
Tests if themes are outdated, or unnecessary.
|
populate_network_meta()wp-admin/includes/schema.php |
Creates WordPress network meta and sets the default values.
|
WP_REST_Themes_Controller::get_items()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Retrieves a collection of themes.
|
WP_REST_Themes_Controller::prepare_item_for_response()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Prepares a single theme output for response.
|
WP_REST_Posts_Controller::check_template()wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php |
Checks whether the template is valid for the given post.
|
wp_edit_theme_plugin_file()wp-admin/includes/file.php |
Attempts to edit a file for a theme or plugin.
|
WP_REST_Posts_Controller::handle_template()wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php |
Sets the template for a post.
|
wp_ajax_install_theme()wp-admin/includes/ajax-actions.php |
Handles installing a theme via AJAX.
|
wp_ajax_update_theme()wp-admin/includes/ajax-actions.php |
Handles updating a theme via AJAX.
|
wp_ajax_delete_theme()wp-admin/includes/ajax-actions.php |
Handles deleting a theme via AJAX.
|
WP_Theme::get_core_default_theme()wp-includes/class-wp-theme.php |
Determines the latest WordPress default theme that is installed.
|
WP_Automatic_Updater::update()wp-admin/includes/class-wp-automatic-updater.php |
Updates an item, if appropriate.
|
Language_Pack_Upgrader::get_name_for_update()wp-admin/includes/class-language-pack-upgrader.php |
Gets the name of an item being updated.
|
Theme_Upgrader::theme_info()wp-admin/includes/class-theme-upgrader.php |
Gets the WP_Theme object for a theme.
|
wp_prepare_themes_for_js()wp-admin/includes/theme.php |
Prepares themes for JavaScript.
|
delete_theme()wp-admin/includes/theme.php |
Removes a theme.
|
get_page_templates()wp-admin/includes/theme.php |
Gets the page templates available in this theme.
|
current_theme_info()wp-admin/includes/deprecated.php |
Retrieves information on the current active theme.
|
WP_Theme_Install_List_Table::_get_theme_status()wp-admin/includes/class-wp-theme-install-list-table.php |
Checks to see if the theme is already installed.
|
populate_options()wp-admin/includes/schema.php |
Create WordPress options and set the default values.
|
update_right_now_message()wp-admin/includes/update.php |
Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget.
|
get_theme_updates()wp-admin/includes/update.php |
Retrieves themes with updates available.
|
wp_ajax_query_themes()wp-admin/includes/ajax-actions.php |
Handles getting themes from themes_api() via AJAX.
|
WP_Customize_Manager::theme()wp-includes/class-wp-customize-manager.php |
Gets the theme being customized.
|
WP_Customize_Manager::__construct()wp-includes/class-wp-customize-manager.php |
Constructor.
|
check_theme_switched()wp-includes/theme.php |
Checks if a theme has been changed and runs ‘after_switch_theme’ hook on the next WP load.
|
remove_theme_mods()wp-includes/theme.php |
Removes theme modifications option for the active theme.
|
switch_theme()wp-includes/theme.php |
Switches the theme.
|
validate_current_theme()wp-includes/theme.php |
Checks that the active theme has the required files.
|
get_theme_mods()wp-includes/theme.php |
Retrieves all theme modifications.
|
get_current_theme()wp-includes/deprecated.php |
Retrieve current theme name.
|
wp_insert_post()wp-includes/post.php |
Inserts or update a post.
|
Skip to note 11 content
Codex
Echo the name of an installed theme
exists() ) echo esc_html( $my_theme ); ?>Skip to note 12 content
tazotodua
Result:
object(WP_Theme)[916] public 'update' => boolean false private 'theme_root' => string 'home/path/wp-content/themes' (length=77) private 'headers' => array (size=11) 'Name' => string 'mytheme' (length=7) 'ThemeURI' => string 'http://example.com/' (length=22) 'Description' => string 'Description' (length=11) 'Author' => string 'Something Here' (length=14) 'AuthorURI' => string 'http://example.com/' (length=22) 'Version' => string '1.0.0' (length=5) 'Template' => string '' (length=0) 'Status' => string '' (length=0) 'Tags' => string 'custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready' (length=98) 'TextDomain' => string 'mytheme' (length=7) 'DomainPath' => string '' (length=0) private 'headers_sanitized' => null private 'name_translated' => null private 'errors' => null private 'stylesheet' => string 'mytheme' (length=7) private 'template' => string 'mytheme' (length=7) private 'parent' => null private 'theme_root_uri' => null private 'textdomain_loaded' => null private 'cache_hash' => string 'ca9dd01f01f2a5cb4616a776eff52690' (length=32)Skip to note 13 content
Codex
Get other data: Text domain & theme URI
get( 'TextDomain' ) ); echo esc_html( $my_theme->get( 'ThemeURI' ) ); ?>Skip to note 14 content
vebbmaster
Switch a specific theme on all sites in a multisite installation
blog_id ); $blog_theme = wp_get_theme(); if ( 'twentyeleven' === $blog_theme ) { switch_theme( 'twentytwenty' ); restore_current_blog(); } } } wpdocs_switch_all_multisite_themes(); ?>Skip to note 15 content
Alberuni Azad.
Get the directory name of the current theme regardless of the child theme.
function wpdocs_get_current_theme_directory(){ $current_theme_dir = ''; $current_theme = wp_get_theme(); if( $current_theme->exists() && $current_theme->parent() ){ $parent_theme = $current_theme->parent(); if( $parent_theme->exists() ){ $current_theme_dir = $parent_theme->get_stylesheet(); } } elseif( $current_theme->exists() ) { $current_theme_dir = $current_theme->get_stylesheet(); } return $current_theme_dir; } echo wpdocs_get_current_theme_directory();Skip to note 16 content
Deepak Rajpal
Code to Display current or any installed theme version:
Display current theme version:
$theme_info = wp_get_theme(); echo $theme_info->get( 'Version' );Display any of installed theme version using directory name:
$theme_info = wp_get_theme( 'twentytwentyfour' ); echo $theme_info->get( 'Version' );Skip to note 17 content
Ben Sibley
As of WP 6.7, make sure not to call this function any earlier than the “init” hook, or it will trigger the following error:
PHP Notice: Function _load_textdomain_just_in_time was called incorrectly
Skip to note 18 content
Codex
Display the current theme author URI
$my_theme = wp_get_theme(); echo esc_html( $my_theme->get( 'AuthorURI' ) );Skip to note 19 content
Codex
Display the current theme’s version
$my_theme = wp_get_theme(); printf( "%1$s is version %2$s", $my_theme->get( 'Name' ), $my_theme->get( 'Version' ) );Skip to note 20 content
Codex
Echo the name of the current active theme