Skip to content

Editor: Preload REST requests the post editor fetches on mount#11948

Closed
ellatrix wants to merge 2 commits into
WordPress:trunkfrom
ellatrix:try/preload-post-editor-bound-gets
Closed

Editor: Preload REST requests the post editor fetches on mount#11948
ellatrix wants to merge 2 commits into
WordPress:trunkfrom
ellatrix:try/preload-post-editor-bound-gets

Conversation

@ellatrix

@ellatrix ellatrix commented May 22, 2026

Copy link
Copy Markdown
Member

What?

Adds four entries to $preload_paths in wp-admin/edit-form-blocks.php:

  • /wp/v2/templates/lookup?slug=front-page: homepage actions (getDefaultTemplateId)
  • /wp/v2/taxonomies?context=edit: taxonomies panel
  • OPTIONS on the current post-type collection: canUser permission probe
  • /wp/v2/users/{author}?context=view&_fields=id,name: post-author display name (only when the post type supports author)

Why?

The post editor fetches all four on first mount. Preloading them serves the data from the inline cache and removes network round-trips from the boot path. Unbounded per_page=-1 queries (comments, wp_pattern_category) are deliberately not preloaded.

Gutenberg counterpart

WordPress/gutenberg#78565

Trac ticket

https://core.trac.wordpress.org/ticket/65636

Testing

Gutenberg's preload spec (test/e2e/specs/preload/post-editor.spec.js) asserts these URLs no longer fire as post-mount network requests.

@github-actions

github-actions Bot commented May 22, 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 ellatrix, wildworks.

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.

@t-hamano

t-hamano commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@ellatrix Should this PR be committed to 7.1?

@t-hamano

t-hamano commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

I would appreciate it if you could proceed with this PR and commit it in time for the 7.1 Beta1 release on July 15.

…rwise fetch post-mount.

Adds four entries to `\$preload_paths` in `wp-admin/edit-form-blocks.php`:

* `/wp/v2/templates/lookup?slug=front-page` — used by the editor's
  homepage actions gate (`shouldShowHomepageActions`).
* `/wp/v2/taxonomies?context=edit` — read by the post-taxonomies
  sidebar panel; non-paginated endpoint with a small bounded payload.
* `OPTIONS` for the current post-type collection — collection-level
  permission probe.
* `/wp/v2/users/{author}?context=view&_fields=id,name` — read by the
  post-author panel.

Each of these is captured today as a post-mount network fetch by
Gutenberg's post-editor preload e2e spec; preloading them eliminates
those requests from the boot path.
@ellatrix
ellatrix force-pushed the try/preload-post-editor-bound-gets branch from eafee24 to 35ac2d2 Compare July 15, 2026 03:14
@ellatrix ellatrix changed the title Editor: Preload bound single-resource GETs the post editor would otherwise fetch post-mount Editor: Preload REST requests the post editor fetches on mount Jul 15, 2026
pento pushed a commit that referenced this pull request Jul 15, 2026
Add four entries to the block editor preload paths in `wp-admin/edit-form-blocks.php`: the front-page template lookup, the taxonomies list, the `OPTIONS` permissions request for the post type collection, and, for post types that support it, the post author's display name. The editor previously requested all of these over the network on first load.

Developed in #11948.

Props ellatrix, mamaduka.
Fixes #65636.


git-svn-id: https://develop.svn.wordpress.org/trunk@62749 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: 62749
GitHub commit: 5a4a061

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 Jul 15, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 15, 2026
Add four entries to the block editor preload paths in `wp-admin/edit-form-blocks.php`: the front-page template lookup, the taxonomies list, the `OPTIONS` permissions request for the post type collection, and, for post types that support it, the post author's display name. The editor previously requested all of these over the network on first load.

Developed in WordPress/wordpress-develop#11948.

Props ellatrix, mamaduka.
Fixes #65636.

Built from https://develop.svn.wordpress.org/trunk@62749


git-svn-id: http://core.svn.wordpress.org/trunk@62033 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