Skip to content

Editor: Preload the entity fields and actions the editors read - #14516

Open
jorgefilipecosta wants to merge 1 commit into
WordPress:trunkfrom
jorgefilipecosta:add/preload-entity-fields-and-actions
Open

jorgefilipecosta wants to merge 1 commit into
WordPress:trunkfrom
jorgefilipecosta:add/preload-entity-fields-and-actions

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Backports the preloads of WordPress/gutenberg#85081 (post editor entity fields) and WordPress/gutenberg#85155 (site editor entity actions).

The editors read the fields and actions of the post types they show from /wp/v2/entity-fields and /wp/v2/entity-actions. Core preloads the fields in the site editor and the actions in the post editor, but not the other way around.

This PR:

  • Makes _wp_preload_entity_fields() also preload the fields of the edited post type in the post editor, which the post summary of its inspector reads since Editor: Stabilize the DataForm-based inspector gutenberg#85081.
  • Makes _wp_preload_entity_actions() also preload, in the site editor, the actions of the edited post and of the post types its screen lists (pages, templates, patterns and template parts), reusing _wp_get_site_editor_screen_post_types().
  • Replaces the test that asserted the post editor does not preload the fields, and covers the site editor actions per screen.

The new requests only happen once Core's Gutenberg pin includes the code that reads both routes. Until then the preloads go unused, as the existing ones do.

Testing Instructions

  1. With a Gutenberg pin that includes Editor: Stabilize the DataForm-based inspector gutenberg#85081, open a page in the post editor and verify no /wp/v2/entity-fields?kind=postType&name=page request is made.
  2. Open wp-admin/site-editor.php?p=%2Fpage and verify no /wp/v2/entity-actions?kind=postType&name=page request is made. Do the same on ?p=%2Ftemplate (wp_template) and ?p=%2Fpattern (wp_block and wp_template_part).
  3. Run npm run test:php -- --group entity-fields,entity-actions.

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

Use of AI Tools

AI assistance: Yes
Used for: writing the code and the tests, 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.

The post editor now preloads the entity fields of the edited post type,
which the post summary of its inspector reads, and the site editor
preloads the entity actions of the edited post and of the post types its
screen lists, as it already did for the entity fields.
@github-actions

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.

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

@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.

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.

1 participant