WP_Theme_JSON_Resolver::get_core_data()public staticWP 5.8.0

Returns core's origin config.

Метод класса: WP_Theme_JSON_Resolver{}

Хуки из метода

Возвращает

WP_Theme_JSON. Entity that holds core data.

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

$result = WP_Theme_JSON_Resolver::get_core_data();

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

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

Код WP_Theme_JSON_Resolver::get_core_data() WP 6.7.1

public static function get_core_data() {
	if ( null !== static::$core && static::has_same_registered_blocks( 'core' ) ) {
		return static::$core;
	}

	$config = static::read_json_file( __DIR__ . '/theme.json' );
	$config = static::translate( $config );

	/**
	 * Filters the default data provided by WordPress for global styles & settings.
	 *
	 * @since 6.1.0
	 *
	 * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
	 */
	$theme_json = apply_filters( 'wp_theme_json_data_default', new WP_Theme_JSON_Data( $config, 'default' ) );

	/*
	 * Backward compatibility for extenders returning a WP_Theme_JSON_Data
	 * compatible class that is not a WP_Theme_JSON_Data object.
	 */
	if ( $theme_json instanceof WP_Theme_JSON_Data ) {
		static::$core = $theme_json->get_theme_json();
	} else {
		$config       = $theme_json->get_data();
		static::$core = new WP_Theme_JSON( $config, 'default' );
	}

	return static::$core;
}