Skip to content

Commit 1c86d8c

Browse files
oandregalclaude
andcommitted
REST API: Add the entity fields endpoint.
Registers the `/wp/v2/entity-fields` route, served by `WP_REST_Entity_Fields_Controller`. Given an entity kind and name, it returns the fields registered for the entity with the Entity Fields API, and the script modules providing their JavaScript parts, each with the ids of the fields it applies to. Access mirrors the `/wp/v2/view-config` route: post types require their own `edit_posts` capability, taxonomies their `manage_terms` capability, and root entities `manage_options`. Post types and taxonomies that are not registered or not exposed in the REST API are not found. Synced from WordPress/gutenberg#84078. Synced from WordPress/gutenberg#84691. See #66229. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f3ceadf commit 1c86d8c

4 files changed

Lines changed: 679 additions & 0 deletions

File tree

‎src/wp-includes/rest-api.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ function create_initial_rest_routes() {
440440
// Entity Actions.
441441
$entity_actions_controller = new WP_REST_Entity_Actions_Controller();
442442
$entity_actions_controller->register_routes();
443+
444+
// Entity Fields.
445+
$entity_fields_controller = new WP_REST_Entity_Fields_Controller();
446+
$entity_fields_controller->register_routes();
443447
}
444448

445449
/**

0 commit comments

Comments
 (0)