WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get theme roots

Description

Retrieves an array of the names of theme directories keyed by the template/stylesheet or the name of the themes directory if all the themes have the same parent (root) directory. The names are without the trailing but with the leading slash.

Usage

 <?php echo get_theme_roots(); ?> 

Parameters

This tag has no parameters.

Return Values

(array/string) 
An array of the names of theme directories keyed by the template/stylesheet or the name of the themes directory if all themes have the same parent directory. The names are without the trailing but with the leading slash.

Example

echo get_theme_roots();

If your themes directory is located at /home/www/wp-content/themes/, the above echo statement will output "/themes".

Notes

Change Log

  • Since: 2.9.0

Source File

get_theme_roots() is located in wp-includes/theme.php.

Related

Theme paths: get_template(), get_template_directory(), get_template_directory_uri(), get_theme_roots(), get_theme_root(), get_theme_root_uri(), get_stylesheet(), get_stylesheet_uri(), get_stylesheet_directory(), get_stylesheet_directory_uri(), get_bloginfo(), get_theme_file_uri(), get_theme_file_path()

WordPress Directories:
home_url() Home URL http://www.example.com
site_url() Site directory URL http://www.example.com or http://www.example.com/wordpress
admin_url() Admin directory URL http://www.example.com/wp-admin
includes_url() Includes directory URL http://www.example.com/wp-includes
content_url() Content directory URL http://www.example.com/wp-content
plugins_url() Plugins directory URL http://www.example.com/wp-content/plugins
theme_url() Themes directory URL (#18302) http://www.example.com/wp-content/themes
wp_upload_dir() Upload directory URL (returns an array) http://www.example.com/wp-content/uploads