Uses
Uses | Description |
---|---|
wp-includes/theme.php: search_theme_directories() | Searches all registered theme directories for complete and valid themes. |
wp-includes/option.php: get_site_transient() | Retrieves the value of a site transient. |
Retrieves theme roots.
(array|string) An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.
The names of theme directories are without the trailing but with the leading slash.
File: wp-includes/theme.php
function get_theme_roots() { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_roots = get_site_transient( 'theme_roots' ); if ( false === $theme_roots ) { search_theme_directories( true ); // Regenerate the transient. $theme_roots = get_site_transient( 'theme_roots' ); } return $theme_roots; }
Version | Description |
---|---|
2.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_theme_roots