For metadata values that can either be booleans or paths to booleans, gets the value.
$data = array( ‘color’ => array( ‘defaultPalette’ => true ) );
static::get_metadata_boolean( $data, false );
// => false
static::get_metadata_boolean( $data, array( 'color', 'defaultPalette' ) );
// => true$dataarrayrequired
$pathbool|arrayrequired
$default_valuebooloptional
Default:false
* [
* 'path' => ['path', 'to', 'other', 'node' ],
* 'selector' => 'CSS selector for other node',
* 'duotone' => null
* ],
* ]
*
* @since 5.8.0
* @since 6.6.0 Added options array for modifying generated nodes.
*
* @param array $theme_json The tree to extract style nodes from.
* @param array $selectors List of selectors per block.
* @param array $options {
* Optional. An array of options for now used for internal purposes only (may change without notice).
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/get_metadata_boolean