Skip to content

Editor: Register the core entity actions on the server - #14509

Closed
jorgefilipecosta wants to merge 2 commits into
WordPress:trunkfrom
jorgefilipecosta:add/core-entity-actions
Closed

jorgefilipecosta wants to merge 2 commits into
WordPress:trunkfrom
jorgefilipecosta:add/core-entity-actions

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Backports the PHP changes of WordPress/gutenberg#84660, a follow-up to #14276.

Gutenberg now registers the core actions (Trash, Rename, Duplicate…) on the server, through the entity actions API, and the editors read them from /wp/v2/entity-actions. This PR makes Core register them too.

This PR:

  • Copies the PHP files of @wordpress/core-actions from the Gutenberg build to wp-includes/build/scripts/core-actions/, 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.
  • Adds _wp_preload_entity_actions(), which preloads the actions of the post type the post editor edits.
  • Ports the tests of register_core_entity_actions(), without the "Duplicate…" action of posts, which is only registered in the Gutenberg plugin.

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. In the console, run await wp.apiFetch( { path: '/wp/v2/entity-actions?kind=postType&name=page' } ) and verify it returns the actions of pages and the @wordpress/core-actions/post_type_supports module.
  3. On the same screen, verify the actions menus of a draft and a published page, and rename, trash, restore and permanently delete a page. In the patterns screen, rename and duplicate a pattern.
  4. Open a page in the post editor and verify the actions menu of the inspector. Verify in the Network panel that the editor made no request to /wp/v2/entity-actions, which is preloaded.
  5. Run npm run test:php -- --group entity-actions.

Gutenberg PR: WordPress/gutenberg#84660

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

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.

Loads `register_core_entity_actions()` from the `core-actions` package, which registers the actions of posts, pages, patterns and template parts through the entity actions API at priority 0, so a plugin can unregister or replace them. The build copies its PHP files to `wp-includes/build/scripts/core-actions/`.
The post editor also preloads the actions of the post type it edits.

Synced from WordPress/gutenberg#84660.

See #66343.
@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.

…ludes them.

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

See #66343.

@oandregal oandregal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this as part of #14514

@jorgefilipecosta
jorgefilipecosta marked this pull request as ready for review October 19, 2026 19:41
@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, oandregal.

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

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

SVN changeset: 64566
GitHub commit: a9398d7

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