mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
REST API: Delete fresh_site option when updating widgets via REST API
Adds new hooks (rest_save_sidebar, rest_delete_widget, rest_after_save_widget) to the widgets REST API and uses them to delete the fresh_site option when updating widgets via the REST API. This ensures that starter content isn't loaded in the Customizer after a user makes changes. Fixes #53317. Props kevin940726, garrett-eclipse, andraganescu, hellofromtonya. git-svn-id: https://develop.svn.wordpress.org/trunk@51068 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -209,6 +209,15 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller {
|
||||
|
||||
$sidebar = $this->get_sidebar( $request['id'] );
|
||||
|
||||
/**
|
||||
* Fires after a sidebar is updated via the REST API.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @param array $sidebar The updated sidebar.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
*/
|
||||
do_action( 'rest_save_sidebar', $sidebar, $request );
|
||||
|
||||
return $this->prepare_item_for_response( $sidebar, $request );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user