[wp-trac] [WordPress Trac] #42864: REST API: Fire an action after items are completely inserted/updated
WordPress Trac
noreply at wordpress.org
Mon Dec 11 04:09:44 UTC 2017
#42864: REST API: Fire an action after items are completely inserted/updated
--------------------------+-----------------------
Reporter: pento | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: | Focuses: rest-api
--------------------------+-----------------------
Comment (by rmccue):
I thought these were ''also'' inconsistent, but as it turns out, I think
r39288 helped make them consistent, although in the process we lost a
crucial ability. We should introduce common hooks across all of these for
a final action:
* `rest_insert_attachment` is after attachment creation/update, but before
meta + additional fields
* `rest_insert_comment` is after comment creation/update, but before meta
+ additional fields
* `rest_insert_{post}` is after post creation/update, but before meta +
additional fields + sticky + terms + featured media (`{post}` is the post
type).
* `rest_insert_{term}` is after term creation/update, but before meta +
additional fields (`{term}` is the taxonomy)
* `rest_insert_user` is after user creation/update, but before roles +
meta + additional fields
These actions are still useful if you want to do something when the object
is updated, but not as useful as they could be.
I'm thinking a `rest_did_insert_{type}` for all of these across the board,
called with the same parameters, but fired at the end of the relevant
method rather than after the object change.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42864#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list