#54498 closed defect (bug) (fixed)
New FSE REST Endpoints may need to manually call `wp_after_insert_post()`
Reported by: | peterwilsoncc | Owned by: | spacedmonkey |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | 5.9 |
Component: | REST API | Keywords: | has-patch |
Focuses: | rest-api | Cc: |
Description
The following REST API endpoints used for FSE store data in the post table and may need to be altered to manually call wp_after_insert_post()
after disabling it as part of the call to wp_insert_post()
and related functions.
The purpose of the wp_after_insert_post
hook (fired by the function of the same name) is to fire after all data for a post has been updated: the post object, the terms and the meta data.
WP_REST_Global_Styles_Controller::update_item()
may update meta data after the call towp_update_post()
WP_REST_Menu_Items_Controller
both for create and update methods. This may require changes to the signature forwp_update_nav_menu_item()
WP_REST_Templates_Controller
both for create and update methods.
I've put this on the 5.9 milestone for consideration as it relates to the FSE features.
Change History (13)
This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-restapi by antonvlasenko. View the logs.
3 years ago
#3
@
3 years ago
- Focuses rest-api added
- Keywords needs-patch added
- Owner set to spacedmonkey
- Status changed from new to assigned
- Version set to trunk
This ticket was mentioned in Slack in #core-restapi by zieladam. View the logs.
3 years ago
This ticket was mentioned in PR #1951 on WordPress/wordpress-develop by spacedmonkey.
3 years ago
#5
- Keywords has-patch added; needs-patch removed
This ticket was mentioned in PR #1952 on WordPress/wordpress-develop by spacedmonkey.
3 years ago
#6
Trac ticket: https://core.trac.wordpress.org/ticket/54498
This ticket was mentioned in PR #1953 on WordPress/wordpress-develop by spacedmonkey.
3 years ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/54498
#8
@
3 years ago
@peterwilsoncc @TimothyBlynJacobs I have created PRs for all the endpoints. I created PRs for all the different endpoints for easier review.
Once, I get a positive review from any of the PRs, I will commit the changes, as this change is simple and harmless.
I created a related issue #54520 on a very similar matter. I would also like to get eyes on this as well.
This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.
3 years ago
#10
@
3 years ago
- Resolution set to fixed
- Status changed from assigned to closed
This was committed in [52276] but with the wrong ticket annotation:
REST API: Fire
wp_after_insert_post
later in new post object endpoints.
In the new menu items, global items and template controllers manually call the function
wp_after_insert_post()
to manually fire the action of the same name after all potential data is updated.
This accounts for the use case in which a theme or plugin developer has modified the endpoints use of either taxonomy or meta data.
The new parameter
$fire_after_hooks
is added towp_update_nav_menu_item()
to control whether thewp_after_insert_post
action is fired when it in turn callswp_insert_post()
.
Props spacedmonkey, peterwilsoncc, zieladam.
peterwilsoncc commented on PR #1952:
3 years ago
#11
Committed in https://core.trac.wordpress.org/changeset/52276
peterwilsoncc commented on PR #1951:
3 years ago
#12
Committed in https://core.trac.wordpress.org/changeset/52276
peterwilsoncc commented on PR #1953:
3 years ago
#13
Committed in https://core.trac.wordpress.org/changeset/52276
Trac ticket: https://core.trac.wordpress.org/ticket/54498