Commit 95705686e2 for wordpress.org

commit 95705686e29a28d4a0b61caecaca7a041148aed4
Author: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Date:   Mon Oct 19 19:52:52 2026 +0000

    Editor: Register the core entity actions on the server.

    Gutenberg registers the core actions (Trash, Rename, Duplicate, …) on the
    server through the entity actions API, and the editors read them from the
    `wp/v2/entity-actions` route. Register them in Core the same way.
    Copy the PHP files of `@wordpress/core-actions` from the Gutenberg build in the
    `gutenberg-php` Grunt copy task, alongside `routes.php` and `pages.php`, and
    load their `index.php` from `wp-settings.php`.
    Also preload the actions of the post type the post editor edits, so its actions
    menu reads them from the preloaded data instead of requesting the route as it
    loads.

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


    git-svn-id: http://core.svn.wordpress.org/trunk@63716 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 16afab80fc..d2fb5d59a8 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -855,6 +855,7 @@ add_filter( 'get_entity_view_config_root_site', '_wp_get_entity_view_config_root

 // Entity Actions API.
 add_action( 'admin_footer', '_wp_add_entity_action_modules_to_editor_script', 10, 0 );
+add_filter( 'block_editor_rest_api_preload_paths', '_wp_preload_entity_actions', 10, 2 );

 // Entity Fields API.
 add_action( 'admin_footer', '_wp_add_entity_field_modules_to_editor_script', 10, 0 );
diff --git a/wp-includes/entity-actions.php b/wp-includes/entity-actions.php
index 6496048f71..13ec78bc03 100644
--- a/wp-includes/entity-actions.php
+++ b/wp-includes/entity-actions.php
@@ -15,7 +15,8 @@
  *
  * Actions are registered on the `wp_entity_actions_api_init` action, and only there,
  * with {@see wp_register_entity_actions()} and {@see wp_unregister_entity_actions()}. The
- * other functions read the registry.
+ * other functions read the registry. WordPress core registers its own
+ * actions the same way, from packages/core-actions.
  *
  * @package WordPress
  * @subpackage Entity Actions
@@ -186,3 +187,32 @@ function _wp_add_entity_action_modules_to_editor_script( $scripts = null ) {
 		$scripts->add_data( 'wp-editor', 'module_dependencies', $dependencies );
 	}
 }
+
+/**
+ * Preloads the actions of the post type the post editor edits.
+ *
+ * The actions menu of the post editor reads them from the `wp/v2/entity-actions`
+ * route as it loads, see `useEntityActions()` in
+ * packages/editor/src/dataviews/entity-actions-loader.ts. The path must match the
+ * request of the `getEntityActionsConfig` core data resolver, see
+ * packages/core-data/src/resolvers.js.
+ *
+ * @since 7.2.0
+ *
+ * @param array                   $paths   REST API paths to preload.
+ * @param WP_Block_Editor_Context $context Block editor context.
+ * @return array Filtered preload paths.
+ */
+function _wp_preload_entity_actions( $paths, $context ) {
+	if ( 'core/edit-post' === $context->name && isset( $context->post ) ) {
+		$paths[] = add_query_arg(
+			array(
+				'kind' => 'postType',
+				'name' => $context->post->post_type,
+			),
+			'/wp/v2/entity-actions'
+		);
+	}
+
+	return $paths;
+}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 8ac8463bf1..213f83022c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64565';
+$wp_version = '7.2-alpha-64566';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-settings.php b/wp-settings.php
index 98ecc57819..cc7a1e00a3 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -254,6 +254,9 @@ if ( file_exists( ABSPATH . WPINC . '/build/routes.php' ) ) {
 if ( file_exists( ABSPATH . WPINC . '/build/pages.php' ) ) {
 	require ABSPATH . WPINC . '/build/pages.php';
 }
+if ( file_exists( ABSPATH . WPINC . '/build/scripts/core-actions/index.php' ) ) {
+	require ABSPATH . WPINC . '/build/scripts/core-actions/index.php';
+}
 require ABSPATH . WPINC . '/taxonomy.php';
 require ABSPATH . WPINC . '/class-wp-taxonomy.php';
 require ABSPATH . WPINC . '/class-wp-term.php';