WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#40722 closed defect (bug) (fixed)

Customize: The starter content fresh_site flag is not successfully cleared when editing widgets on admin screen

Reported by: westonruter Owned by: westonruter
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch commit
Focuses: Cc:
PR Number:

Description

After a fresh install, if you go to the widgets admin screen and make changes to widgets and sidebars, and then go into the Customizer you'll see that starter content from Twenty Seventeen overrides the changes you made on the admin screen. In other words, changes to widgets on the admin screen are not successfully clearing the fresh_site flag.

In the following logic in default-filters.php:

<?php
// Mark site as no longer fresh
foreach ( array( 'publish_post', 'publish_page', 'wp_ajax_save-widget', 'wp_ajax_widgets-order', 'customize_save_after' ) as $action ) {
    add_action( $action, '_delete_option_fresh_site' );
}

The action is added at the default priority of 10. This is problematic for the wp_ajax_save-widget and wp_ajax_widgets-order actions specifically because in admin-ajax.php, it adds action handlers to happen at priority 1. The net result is that _delete_option_fresh_site never gets called for these actions because Ajax handlers die when they complete. The solution then is to change the priority to be 0.

See:
https://wordpress.slack.com/archives/C0381N237/p1494419740017818
https://github.com/xwp/wp-core-media-widgets/issues/169

Attachments (1)

40722.0.diff (582 bytes) - added by westonruter 2 years ago.

Download all attachments as: .zip

Change History (4)

@westonruter
2 years ago

#1 @westonruter
2 years ago

  • Keywords has-patch needs-testing added
  • Owner set to westonruter
  • Status changed from new to accepted

#2 @westonruter
2 years ago

  • Keywords commit added; needs-testing removed

#3 @westonruter
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 40608:

Customize: Fix clearing of fresh_site option flag when editing sidebars on widgets admin screen.

Amends [38991].
See #38114, #38533.
Fixes #40722.

Note: See TracTickets for help on using tickets.