Repository navigation
Conversation
The author field of the post summary queries the users collection with `who=authors`. It wasn't preloaded because `WP_User_Query` reports `who` as deprecated, and during a page render the notice is printed into the page. REST requests report deprecated arguments in a header, so internal ones now don't print them either, and the author is preloaded in the post editor and for pages in the site editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. 📦 Bundle sizeSize Change: +38 B (0%) Total Size: 8.57 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Actions are reachable via RIGHT/LEFT arrow keys (Site Editor v2) in
|
Silencing deprecated argument notices around every REST callback reached far beyond the one request that needs it. Preload the author with its own call instead, and silence the notice only around that call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
We should try to fix https://core.trac.wordpress.org/ticket/56429. I have a draft patch; I will try to submit it on Monday. The problem with this approach is that it only solves issue for plugin. I think silencing the warning will be blocked in the backport PR. |
|
Agreed, thanks @Mamaduka |
What?
Follow up to #85081. See #85118.
Preloads the author request of the post summary, in the post editor and for pages in the site editor, so it's no longer sent after the editor loads.
Why?
#85081 switched the author field to
GET /wp/v2/users?include[0]=<id>&who=authors(AuthorViewincore-fields) and dropped the old author preload. The new request couldn't be preloaded:WP_User_Queryreportswhoas deprecated, and preloading runs while the page renders, so withWP_DEBUGon the notice was printed before<!DOCTYPE html>. That's the default on wp-env development sites.A real REST request doesn't print it: Core reports deprecated arguments in a header instead (
rest_api_default_filters()). Preloaded requests didn't get that treatment.How?
preload.php: the author request is preloaded with its ownrest_preload_api_request()call, next to where Editor: Stabilize the DataForm-based inspector #85081 removes the old author preload, and for pages in the site editor.deprecated_argument_trigger_errorreturns false only around that call, so nothing else is affected. Its data goes towp-api-fetchin its own preloading middleware.edit-post: the startup kickoff requests the author with the same query asAuthorView, so the preload is used beforeclearPreloadedData()runs.The site editor's templates and form config requests from #85081 are preloaded in #78521, so this PR leaves them out.
Checked locally with
WP_DEBUGon, editing a post and a page:<b>Deprecated</b>: Function WP_User_Query was called with an argument that is deprecated…<!DOCTYPE html>The updated preload e2e tests fail on trunk's code (the author request is sent in both editors) and pass with this PR. I couldn't run PHPUnit locally, so the new PHP tests run first in CI.
For Core, the silencing would go around the
rest_do_request()call inrest_preload_api_request(), and the path could join the post editor's preload list.Testing Instructions
WP_DEBUGon, open a post in the post editor with the browser's network panel open.users?…who=authorsrequest is sent, and the author shows in the post summary.<!DOCTYPE html>, with no deprecation notice before it.site-editor.php?p=/page/<id>&canvas=edit) and check the same.Testing Instructions for Keyboard
None, no UI change.
Screenshots or screencast
None: the change is in the network requests and the page source, shown in the table above.
Use of AI Tools
Authored with Claude Code (Claude Opus 5.5), reviewed by me.
🤖 Generated with Claude Code