wp_get_global_settings() – Function to get the settings resulting of merging core, theme, and user data.

You appear to be a bot. Output may be restricted

Description

Gets the settings resulting of merging core, theme, and user data.

Usage

$array = wp_get_global_settings( $path, $context );

Parameters

$path
( array ) optional – Path to the specific setting to retrieve. Optional. If empty, will return all settings.
$context
( array ) optional – { Metadata to know where to retrieve the $path from. Optional.
$block_name
( string ) optional – Which block to retrieve the settings from. If empty, it'll return the settings for the global context.
$origin
( string ) optional – Which origin to take data from. Valid values are 'all' (core, theme, and user) or 'base' (core and theme). If empty or unknown, 'all' is used. }

Returns

array The settings to retrieve.

Source

File name: wordpress/wp-includes/global-styles-and-settings.php
Lines:

1 to 14 of 14
function wp_get_global_settings( $path = array(), $context = array() ) {
  if ( ! empty( $context['block_name'] ) ) {
    $path = array_merge( array( 'blocks', $context['block_name'] ), $path );
  }

  $origin = 'custom';
  if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
    $origin = 'theme';
  }

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

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

 View on GitHub View on Trac