[wp-trac] [WordPress Trac] #50754: REST updating a post without author support updates the author to the current user
WordPress Trac
noreply at wordpress.org
Thu Jul 30 12:38:57 UTC 2020
#50754: REST updating a post without author support updates the author to the
current user
--------------------------+------------------------------
Reporter: jadpm | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by jadpm):
Some more information after debugging this slightly.
It is not enough to preserve the author when collecting the data that the
REST API gets posted when saving a post. That would mostly keep the post
author, but not in all cases.
Given the nature of the legacy metaboxes support, after REST saving a post
with the (blocks) editor, an AJAX call is fired as to save metabox data,
pretending to fire a POST request against the `edit.php` page, hence
firing again an `wp_update_post`. Following the legacy editor logic, in
that request we do not include post author data because there is no author
selector, hence the current user ID is set.
This triggers some extra and probably interesting questions: why are we
saving the post once form the REST APi and then again when saving the
legacy metabox data? May this introduce some other glitches who manifest
in a number of other tickets related to wrong author being set, for
example?
To the topic in this ticket, as I said above, a summary: preserving the
current post author when saving a post with no declared support for this
field is not enough if the post editor contains a legacy metabox.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50754#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list