[wp-trac] [WordPress Trac] #59732: Theme live preview is broken

WordPress Trac noreply at wordpress.org
Wed Oct 25 17:33:13 UTC 2023


#59732: Theme live preview is broken
--------------------------+-----------------------
 Reporter:  karl94        |       Owner:  flixos90
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  6.4
Component:  Themes        |     Version:  5.8
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------
Changes (by flixos90):

 * keywords:   => needs-patch
 * owner:  (none) => flixos90
 * version:  trunk => 5.8
 * status:  new => assigned
 * milestone:  Awaiting Review => 6.4


Comment:

 Thank you for the report @karl94! I have investigated the problem and
 identified the root cause: There are two default filters
 (`_add_default_theme_supports()`, and `wp_enable_block_templates()` as
 you've mentioned), which are hooked into the `setup_theme` action to
 `add_theme_support()` for certain features.

 This is incorrect, as theme support should only be added on the
 `after_setup_theme` hook. Using the `setup_theme` hook does not only
 introduce the above bug, but leads to other problems as well as the theme
 can only be expected to be completely set up ''after'' the `setup_theme`
 action. For example, at the moment these callbacks will add theme support
 based on the current theme which then would still be maintained even when
 previewing another theme in the Customizer.

 It looks like these problems were introduced in [51199] and [52369]
 respectively, therefore pinging @jorgefilipecosta and @audrasjb for
 visibility.

 This should be relatively straightforward to fix by relying on the
 appropriate action `after_setup_theme` instead. There is no relevant usage
 of these functions in the plugin repository which would be affected by
 this change, see https://wpdirectory.net/search/01HDKY6F7BJ58ZD7H6JQ8K4P3S
 and https://wpdirectory.net/search/01HDKY998M6WV6TRE2WR3ZCYG6.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59732#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list