Uses
Uses | Description |
---|---|
wp-includes/theme.php: get_theme_roots() | Retrieves theme roots. |
wp-includes/option.php: get_option() | Retrieves an option value based on an option name. |
Gets the raw theme root relative to the content directory with no filters applied.
(string) (Required) The stylesheet or template name of the theme.
(bool) (Optional) Whether to skip the cache. Defaults to false, meaning the cache is used.
Default value: false
(string) Theme root.
File: wp-includes/theme.php
function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_root = false; // If requesting the root for the current theme, consult options to avoid calling get_theme_roots(). if ( ! $skip_cache ) { if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) { $theme_root = get_option( 'stylesheet_root' ); } elseif ( get_option( 'template' ) == $stylesheet_or_template ) { $theme_root = get_option( 'template_root' ); } } if ( empty( $theme_root ) ) { $theme_roots = get_theme_roots(); if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) { $theme_root = $theme_roots[ $stylesheet_or_template ]; } } return $theme_root; }
Version | Description |
---|---|
3.1.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_raw_theme_root