Reference › WP_Theme_JSON WP_Theme_JSON::get_metadata_boolean ( array $data , bool | array $path , bool $default_value = false ): bool
Since 6.0.0
Source wp-includes/class-wp-theme-json.php:4290Description Parameters Return Uses Source History For metadata values that can either be booleans or paths to booleans, gets the value.
Description $data = array( 'color' => array( 'defaultPalette' => true ) ); static::get_metadata_boolean( $data, false );
// => false
static::get_metadata_boolean( $data, array( 'color', 'defaultPalette' ) );
// => true
Parameters
$dataarray The data to inspect.
$pathbool | arrayBoolean or path to a boolean.
$default_valuebool optional Default value if the referenced path is missing. Default false.Default: false Return
bool Value of boolean metadata. Source View on Trac ↗ View on GitHub ↗
4290 protected static function get_metadata_boolean ( $data , $path , $default_value = false ) { 4291 if ( is_bool ( $path ) ) { 4292 return $path ; 4293 } 4294 4295 if ( is_array ( $path ) ) { 4296 $value = _wp_array_get ( $data , $path ) ; 4297 if ( null !== $value ) { 4298 return $value ; 4299 } 4300 } 4301 4302 return $default_value ; 4303 } History Introduced in 6.0.0 . Unchanged from 6.7.7 through 7.1.0.
6.7.7 6.8.8 6.9.7 7.0.4 7.1.0 Signature, return type and hooks compared across 5 parsed releases.
About this page Parsed data Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/class-wp-theme-json.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. Corrections Something wrong on this page? Report it and it gets fixed in the next regeneration.