wp_json_schema_allowed_keywords filter-hookWP 7.1.0

Filters the JSON Schema keywords allowed for a given schema profile.

Use this to decide which keywords may be exposed to clients for a profile. It does not make WordPress validate or sanitize values against the keyword.

Usage

add_filter( 'wp_json_schema_allowed_keywords', 'wp_kama_json_schema_allowed_keywords_filter', 10, 2 );

/**
 * Function for `wp_json_schema_allowed_keywords` filter-hook.
 * 
 * @param string[] $allowed_keywords Allowed JSON Schema keywords.
 * @param string   $schema_profile   The schema profile the keywords are for.
 *
 * @return string[]
 */
function wp_kama_json_schema_allowed_keywords_filter( $allowed_keywords, $schema_profile ){

	// filter...
	return $allowed_keywords;
}
$allowed_keywords(string[])
Allowed JSON Schema keywords.
$schema_profile(string)
The schema profile the keywords are for.

Changelog

Since 7.1.0 Introduced.

Where the hook is called

wp_get_json_schema_allowed_keywords()
wp_json_schema_allowed_keywords
wp-includes/json-schema.php 68
return apply_filters( 'wp_json_schema_allowed_keywords', $allowed_keywords, $schema_profile );

Where the hook is used in WordPress

Usage not found.