get_theme_roots()WP 2.9.0

Retrieves theme roots.

Хуков нет.

Возвращает

Массив|Строку. An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.

Использование

get_theme_roots();

Заметки

  • Global. Массив. $wp_theme_directories

Список изменений

С версии 2.9.0 Введена.

Код get_theme_roots() WP 6.5.2

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;
}