WP_Theme_JSON::get_settings_slugs( array $settings, array $preset_metadata, string[] $origins = null ): array

In this article

Similar to get_settings_values_by_slug, but doesn’t compute the value.

Parameters

$settingsarrayrequired
Settings to process.
$preset_metadataarrayrequired
One of the PRESETS_METADATA values.
$originsstring[]optional
List of origins to process.

Default:null

Return

array Array of presets where the key and value are both the slug.

Source

			if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) {
				$value_key = $preset_metadata['value_key'];
				$value     = $preset[ $value_key ];
			} elseif (
				isset( $preset_metadata['value_func'] ) &&
				is_callable( $preset_metadata['value_func'] )
			) {
				$value_func = $preset_metadata['value_func'];
				$value      = call_user_func( $value_func, $preset );
			} else {
				// If we don't have a value, then don't add it to the result.
				continue;
			}

			$result[ $slug ] = $value;
		}
	}
	return $result;
}

/**

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.