Skip to content

Commit e87a741

Browse files
André Maneiro (via Claude)claude
authored andcommitted
Editor: Introduce the Fields API and the wp/v2/fields REST route.
Adds a server-side registry of the fields of an entity, `WP_Fields_Registry`, filled on the new `fields_api_init` action, where fields are registered, updated, and unregistered. Fields can also be declared as files and registered with `wp_register_field_collection()`. The registered fields and the script modules providing their JavaScript parts are served by the `wp/v2/fields` route. The script modules are declared as dynamic dependencies of the `wp-editor` script, and the fields of the post types the post editor and the site editor list are preloaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5a889b8 commit e87a741

29 files changed

Lines changed: 3599 additions & 0 deletions

File tree

‎src/wp-includes/class-wp-fields-registry.php‎

Lines changed: 600 additions & 0 deletions
Large diffs are not rendered by default.

‎src/wp-includes/default-filters.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,4 +839,8 @@
839839
}
840840
add_filter( 'get_entity_view_config_root_site', '_wp_get_entity_view_config_root_site', 5 );
841841

842+
// Fields API.
843+
add_action( 'admin_footer', '_wp_add_field_modules_to_editor_script' );
844+
add_filter( 'block_editor_rest_api_preload_paths', '_wp_preload_entity_fields', 10, 2 );
845+
842846
unset( $filter, $action, $post_type );

0 commit comments

Comments
 (0)