WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#38541 closed defect (bug) (fixed)

Allow starter content to apply in a new theme when switching from another theme containing changes

Reported by: westonruter Owned by: westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by westonruter)

See #38114. At the moment, starter content is only applied to the customized state if if there is no changeset post existing for the current UUID. However, if I have a fresh site and I preview Twenty Seventeen and then, without activating, I do a theme switch to another theme that has starter content, I should see that theme's starter content merged on top of the previous starter content since the site is still fresh. A complication here is with the auto-draft post/page. The existence of the changeset provided a locking mechanism to prevent these posts from being created repeatedly in a given session. What needs to be done, however, is to ensure that they only get created once for a given theme's imported starter content.

Attachments (4)

38541.wip.diff (11.1 KB) - added by westonruter 5 months ago.
38541.0.diff (11.5 KB) - added by westonruter 5 months ago.
38541.1.diff (16.2 KB) - added by westonruter 5 months ago.
38541.2.diff (16.7 KB) - added by westonruter 5 months ago.

Download all attachments as: .zip

Change History (10)

#1 @westonruter
5 months ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by helen. View the logs.


5 months ago

This ticket was mentioned in Slack in #core by westonruter. View the logs.


5 months ago

#4 @westonruter
5 months ago

  • Owner set to westonruter
  • Status changed from new to accepted

#5 @westonruter
5 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

@westonruter
5 months ago

@westonruter
5 months ago

@westonruter
5 months ago

#6 @westonruter
5 months ago

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

In 39241:

Customize: Allow starter content to apply in a new theme when switching from another theme containing changes.

  • Ensure that starter content can apply from theme B after previewing starter content in theme A.
  • Introduce new starter_content flag in changeset setting params which is used to capture whether a value is starter content and thus can be overridden.
  • Create changeset up-front with starter_content flags instead of waiting for AUTOSAVE_INTERVAL.
  • Eliminate instantiation of settings for widget instances in favor of directly calling sanitize_widget_js_instance. This eliminates issues with looking for widgets before they are registered.
  • Ensure that non-placeholders (inline arrays instead of string references) can be supplied in starter content.
  • Re-use auto-draft posts as starter content across theme switches.
  • Introduce starter_content param for WP_Customize_Manager::save_changeset_post() which is false except when starter content is being loaded on a fresh_site.

See #38114.
Fixes #38541.

Note: See TracTickets for help on using tickets.