Title: wp_get_json_schema_allowed_keywords
Published: August 20, 2026

---

# wp_get_json_schema_allowed_keywords( string $schema_profile = 'rest-api' ): string[]

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#wp--skip-link--target)

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

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#description)󠁿

Use this when preparing a schema that will be consumed outside of WordPress’s server-
side validation, such as by REST clients, frontend code, or AI providers.

The ‘rest-api’ profile returns the subset of JSON Schema draft-04 keywords that 
the REST API has historically exposed. The ‘draft-04’ profile preserves the larger
draft-04 vocabulary used by clients that can consume standalone schemas.

Allowing a keyword to be exposed does not make WordPress validate or sanitize values
against it.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#parameters)󠁿

 `$schema_profile`stringoptional

Name of the schema profile to get keywords for.
 Accepts `'rest-api'` or `'draft-
04'`. Any other value falls back to the `'rest-api'` profile. Default `'rest-api'`.

Default:`'rest-api'`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#return)󠁿

 string[] Allowed JSON Schema keywords.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#source)󠁿

    ```php
    function wp_get_json_schema_allowed_keywords( string $schema_profile = 'rest-api' ): array {
    	$rest_keywords = rest_get_allowed_schema_keywords();

    	$keywords_by_profile = array(
    		'rest-api' => $rest_keywords,
    		'draft-04' => array_merge(
    			array(
    				'$schema',
    				'id',
    				'$ref',
    			),
    			$rest_keywords,
    			array(
    				'required',
    				'allOf',
    				'not',
    				'definitions',
    				'dependencies',
    				'additionalItems',
    			)
    		),
    	);

    	$allowed_keywords = $keywords_by_profile[ $schema_profile ] ?? $rest_keywords;

    	/**
    	 * 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.
    	 *
    	 * @since 7.1.0
    	 *
    	 * @param string[] $allowed_keywords Allowed JSON Schema keywords.
    	 * @param string   $schema_profile   The schema profile the keywords are for.
    	 */
    	return apply_filters( 'wp_json_schema_allowed_keywords', $allowed_keywords, $schema_profile );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/json-schema.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/json-schema.php#L32)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/json-schema.php#L32-L69)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_json_schema_allowed_keywords’, string[] $allowed_keywords, string $schema_profile )](https://developer.wordpress.org/reference/hooks/wp_json_schema_allowed_keywords/)

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

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#related)󠁿

| Uses | Description | 
| [rest_get_allowed_schema_keywords()](https://developer.wordpress.org/reference/functions/rest_get_allowed_schema_keywords/)`wp-includes/rest-api.php` |

Get all valid JSON schema properties.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [wp_prepare_json_schema_for_client()](https://developer.wordpress.org/reference/functions/wp_prepare_json_schema_for_client/)`wp-includes/json-schema.php` |

Prepares a JSON Schema for clients.

  | 
| [WP_REST_Server::get_data_for_route()](https://developer.wordpress.org/reference/classes/wp_rest_server/get_data_for_route/)`wp-includes/rest-api/class-wp-rest-server.php` |

Retrieves publicly-visible data for the route.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_get_json_schema_allowed_keywords/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_json_schema_allowed_keywords%2F)
before being able to contribute a note or feedback.