get_theme_root_uri()
Gets the URL of the themes directory. The URL does not have a trailing slash.
This function is a wrapper for the construct content_url( 'themes' ).
Uses the global variable $wp_theme_directories.
To get the absolute path to the themes folder use get_theme_root()
Uses: content_url()
1 time — 0.00004 sec (very fast) | 50000 times — 2.11 sec (fast)
Hooks from the function
Returns
String. URL to the template directory.
Usage
get_theme_root_uri( $stylesheet_or_template, $theme_root );
- $stylesheet_or_template(string)
- The name of the theme for which the URL needs to be obtained.
Default: '' - $theme_root(string)
The path to the theme root that will be used in the URL definition. Replaces the call to the function get_raw_theme_root().
Example values:
'/themes' $theme_root = get_option( 'stylesheet_root' ); $theme_root = get_option( 'template_root' ); $theme_roots = get_theme_roots(); $theme_root = $theme_roots[ $stylesheet_or_template ];
Default: ''
Examples
#1 An example of how the function works
$themes_directory = get_theme_root_uri(); echo $themes_directory; // display: // https://example.com/wp-content/themes
Notes
- Global. String[].
$wp_theme_directories
Changelog
| Since 1.5.0 | Introduced. |