Make WordPress Core


Ignore:
Timestamp:
06/04/2021 12:44:41 AM (5 years ago)
Author:
noisysocks
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php

    r50995 r51068  
    210210        $sidebar = $this->get_sidebar( $request['id'] );
    211211
     212        /**
     213         * Fires after a sidebar is updated via the REST API.
     214         *
     215         * @since 5.8.0
     216         * @param array           $sidebar  The updated sidebar.
     217         * @param WP_REST_Request $request  Request object.
     218         */
     219        do_action( 'rest_save_sidebar', $sidebar, $request );
     220
    212221        return $this->prepare_item_for_response( $sidebar, $request );
    213222    }
Note: See TracChangeset for help on using the changeset viewer.