wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_get_global_settings › WordPress Function

Since5.9.0
Deprecatedn/a
wp_get_global_settings ( $path = array(), $block_name = '', $origin = 'all' )
Parameters: (3)
  • (array) $path Path to the specific setting to retrieve. Optional. If empty, will return all settings.
    Required: No
    Default: array()
  • (string) $block_name Which block to retrieve the settings from. Optional If empty, it'll return the settings for the global context.
    Required: No
    Default: (empty)
  • (string) $origin Which origin to take data from. Optional. It can be 'all' (core, theme, and user) or 'base' (core and theme). If empty or unknown, 'all' is used.
    Required: No
    Default: 'all'
Returns:
  • (array) The settings to retrieve.
Defined at:
Codex:

Function to get the settings resulting of merging core, theme, and user data.



Source

function wp_get_global_settings( $path = array(), $block_name = '', $origin = 'all' ) {
	if ( '' !== $block_name ) {
		$path = array_merge( array( 'blocks', $block_name ), $path );
	}

	if ( 'base' === $origin ) {
		$origin = 'theme';
	} else {
		$origin = 'user';
	}

	$settings = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_settings();

	return _wp_array_get( $settings, $path, $settings );
}