[wp-trac] [WordPress Trac] #45114: Fire publishing related hooks after all data is saved via the REST API. (was: Publish posts and fire related hooks on `rest_after_insert_{$this->post_type}` for rest requests.)
WordPress Trac
noreply at wordpress.org
Wed Nov 7 08:45:49 UTC 2018
#45114: Fire publishing related hooks after all data is saved via the REST API.
---------------------------+-----------------------
Reporter: peterwilsoncc | Owner: (none)
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+-----------------------
Comment (by peterwilsoncc):
@danielbachhuber renaming as requested during our Slack conversation with
Pento.
Specific use cases I could see that hit this are:
* Yoast SEO: Accesses terms and write the primary term to meta data
* Jetpack: Uses the `save_post` for sending data required for their
publisize module (a similar use case on my site sent me down this path)
* CMB2, ACF both make use of this group of hooks and have taxonomy/terms
custom meta types - I haven't had a chance to dig into this too deeply but
it hints toward expected data.
In terms of real worlds uses of internal write requests:
* Writing and running tests (ie, ensuring test code and prod code runs the
same)
* WooCommerce has a batch API endpoint, although I think it's intended use
case has REST_REQUEST set to `true`, it just rules out the filter option I
shared with Kadam and he mentioned above)
* I've done it in prior projects because writing post data and term or
meta data via the API internal request is nicer than using
`wp_insert_post`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45114#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list