get_theme_roots

Retrieve theme roots.

Description

(array|string) get_theme_roots(); 

Returns (array|string)

An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.


Usage

  1. if ( !function_exists( 'get_theme_roots' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_theme_roots(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/theme.php  
  1. function get_theme_roots() { 
  2. global $wp_theme_directories; 
  3.  
  4. if ( count($wp_theme_directories) <= 1 ) 
  5. return '/themes'; 
  6.  
  7. $theme_roots = get_site_transient( 'theme_roots' ); 
  8. if ( false === $theme_roots ) { 
  9. search_theme_directories( true ); // Regenerate the transient. 
  10. $theme_roots = get_site_transient( 'theme_roots' ); 
  11. return $theme_roots;