Skip to content

Editor: Register the core entity fields on the server - #14512

Closed
jorgefilipecosta wants to merge 4 commits into
WordPress:trunkfrom
jorgefilipecosta:add/core-entity-fields
Closed

jorgefilipecosta wants to merge 4 commits into
WordPress:trunkfrom
jorgefilipecosta:add/core-entity-fields

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Backports the PHP of WordPress/gutenberg#84696, a follow-up to the entity fields API that landed in r64528.

Gutenberg registers the core fields (title, author, status, the media fields…) on the server, through the entity fields API, and the editors read them from /wp/v2/entity-fields. Core has the API but registers no fields yet, so the title column of the site editor's pages list is blank. This PR makes Core register them.

This PR:

  • Copies the PHP files of @wordpress/core-fields from the Gutenberg build to wp-includes/build/scripts/core-fields/, in the gutenberg-php copy task that copies routes.php and pages.php, and loads its index.php from wp-settings.php the same way.
  • Makes the existing entity fields tests replace the core fields with their fixture defaults, so they keep testing the API alone.
  • Ports the tests of wp_register_core_field_collections() and wp_register_core_post_type_supports_fields().

Some notes:

Testing Instructions

  1. Set gutenberg.sha in package.json to trunk, then run npm run gutenberg:download and npm run build:dev.
  2. Open wp-admin/site-editor.php?p=%2Fpage and verify the pages list shows the titles, authors, and statuses of the pages.
  3. In the console, run await wp.apiFetch( { path: '/wp/v2/entity-fields?kind=postType&name=page' } ) and verify it returns the fields of pages with the @wordpress/core-fields/post_type_supports and @wordpress/core-fields/page modules.
  4. Open the templates and patterns screens of the site editor and verify their titles, descriptions, authors, and sync statuses.
  5. Open a post in the post editor and verify the document sidebar shows its status, publish date, slug, author, template, discussion, and format.
  6. In the same post, add an Image block with an uploaded image, click "Edit image" in its toolbar, and open the "Details" tab: it shows the date added and the author.
  7. Run npm run test:php -- --group entity-fields.

Gutenberg PR: WordPress/gutenberg#84696

Trac ticket: https://core.trac.wordpress.org/ticket/66229

Use of AI Tools

AI assistance: Yes
Used for: porting the code and the tests from the Gutenberg PR, and drafting this description; reviewed and edited by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jorgefilipecosta, oandregal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@oandregal

Copy link
Copy Markdown
Member

I've tested this as part of #14514

Copies the PHP of the `core-fields` package from the Gutenberg build and loads it, so WordPress registers its own fields through the entity fields API: the default fields every post type derives from its supports, and the field collections of pages, templates, template parts, patterns, attachments, navigation menus, and the site.

Synced from WordPress/gutenberg#84696.

See #66229.
Ports the REST controller tests of WordPress/gutenberg#84696: the fields route exposes the default fields of pages and the fields of patterns, with the script modules of their collections and the `core` origin.

See #66229.
…udes them.

The core fields are copied from the Gutenberg build, so their tests are skipped while the pinned build does not include them.

See #66229.
Skipping in `set_up()` still ran `tear_down()`, which restored the theme features before they were captured and set the global to null, dropping the `title-tag` support of the test theme for the rest of the run. A class-level `@requires function` skips before either runs. The REST tests use the same annotation in place of the skip helper.
wporg-sync pushed a commit that referenced this pull request Oct 19, 2026
Gutenberg registers the core fields (title, author, status, the media fields, …) on the server through the entity fields API, and the editors read them from the `wp/v2/entity-fields` route. Core has the API but registered no fields, so the title column of the Site Editor's pages list was blank. Register them in Core the same way.
Copy the PHP files of `@wordpress/core-fields` from the Gutenberg build in the `gutenberg-php` Grunt copy task, next to the core actions, and load their `index.php` from `wp-settings.php`. They register the default fields every post type gets from its supports, plus the field collections of pages, templates, template parts, patterns, attachments, navigation menus, and the site.
The entity fields tests now swap the core fields for their fixture defaults, so they still test the API on its own. The tests for the core fields are skipped until the pinned Gutenberg build includes them.

Developed in #14512.
Synced from WordPress/gutenberg#84696.
Follow-up to [64528].

Props oandregal, jorgefilipecosta.
Fixes #66229.

git-svn-id: https://develop.svn.wordpress.org/trunk@64581 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 64581
GitHub commit: e205f82

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Oct 19, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 19, 2026
Gutenberg registers the core fields (title, author, status, the media fields, …) on the server through the entity fields API, and the editors read them from the `wp/v2/entity-fields` route. Core has the API but registered no fields, so the title column of the Site Editor's pages list was blank. Register them in Core the same way.
Copy the PHP files of `@wordpress/core-fields` from the Gutenberg build in the `gutenberg-php` Grunt copy task, next to the core actions, and load their `index.php` from `wp-settings.php`. They register the default fields every post type gets from its supports, plus the field collections of pages, templates, template parts, patterns, attachments, navigation menus, and the site.
The entity fields tests now swap the core fields for their fixture defaults, so they still test the API on its own. The tests for the core fields are skipped until the pinned Gutenberg build includes them.

Developed in WordPress/wordpress-develop#14512.
Synced from WordPress/gutenberg#84696.
Follow-up to [64528].

Props oandregal, jorgefilipecosta.
Fixes #66229.
Built from https://develop.svn.wordpress.org/trunk@64581


git-svn-id: http://core.svn.wordpress.org/trunk@63731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants