[wp-trac] [WordPress Trac] #45114: Fire publishing related hooks after all data is saved via the REST API.
WordPress Trac
noreply at wordpress.org
Mon Nov 30 22:30:00 UTC 2020
#45114: Fire publishing related hooks after all data is saved via the REST API.
--------------------------------------+----------------------------
Reporter: peterwilsoncc | Owner: peterwilsoncc
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.6
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-dev-note needs-patch | Focuses:
--------------------------------------+----------------------------
Comment (by peterwilsoncc):
`wp_insert_post()` only sets the `$post_before` variable for posts that
are been updated, only `$previous_status` is set for new posts.
For this to go in, a design decision is needed for what `$post_before`
looks like for new posts.
* `false` (which is what `get_post( /* non existent post */ )` returns)
* An almost empty post object: `new WP_Post( [ 'post_status' => 'new',
'post_type' => 'blah' ] );` -- this would need an additional design
decision for any other defaults.
@johnbillion @TimothyBlynJacobs Do you have thoughts? I am slightly
tempted by the latter as it is a consistent type but it needs other
decisions about the defaults (time stamps, etc) as it's a new way of using
`WP_Post` in core.
The new way of doing things/inconsistent type was why I didn't include it
earlier. The third option is to hold off until 5.7 as an enhancement.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45114#comment:60>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list