Make WordPress Core


Ignore:
Timestamp:
06/04/2021 12:44:41 AM (3 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/default-filters.php

    r51058 r51068  
    247247
    248248// Mark site as no longer fresh.
    249 foreach ( array( 'publish_post', 'publish_page', 'wp_ajax_save-widget', 'wp_ajax_widgets-order', 'customize_save_after' ) as $action ) {
     249foreach (
     250    array(
     251        'publish_post',
     252        'publish_page',
     253        'wp_ajax_save-widget',
     254        'wp_ajax_widgets-order',
     255        'customize_save_after',
     256        'rest_after_save_widget',
     257        'rest_delete_widget',
     258        'rest_save_sidebar',
     259    ) as $action
     260) {
    250261    add_action( $action, '_delete_option_fresh_site', 0 );
    251262}
Note: See TracChangeset for help on using the changeset viewer.