函数原型
get_theme_roots(): array|string
函数描述
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.
函数位置
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. |

