[wp-trac] [WordPress Trac] #54838: Automatically enable some templates from inactive themes

WordPress Trac noreply at wordpress.org
Mon Jan 17 08:10:45 UTC 2022


#54838: Automatically enable some templates from inactive themes
-------------------------+-----------------------------
 Reporter:  manfcarlo    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 In the experimental days of FSE, any customisations that were made or new
 templates that were added to one block theme, would actually persist after
 switching to another block theme. This was obviously not a good user
 experience, because one could ostensibly switch their theme and be left
 all but stuck with their old one.

 Accordingly, the behaviour was changed to make all templates and template
 parts associate with one theme only. Now, when switching to another block
 theme, the site gets a fresh start without any of the old theme's
 customisations remaining.

 Of course, the desired behaviour is somewhere in between these two
 extremes. Most notably, if a user creates their own template through the
 template editor that was introduced in 5.8, they are unlikely to want to
 lose it when switching theme. This has been documented in
 [https://github.com/WordPress/gutenberg/issues/31954 this issue] and
 [https://github.com/WordPress/gutenberg/issues/25071 this issue] as well
 as the [https://make.wordpress.org/test/2021/10/05/fse-program-block-
 theme-switching-summary/ user feedback.]

 Automatic rules of precedence are already used to select the correct
 template based on customised vs theme-provided, parent theme vs child
 theme, PHP template vs block template, in addition to the basic template
 hierarchy. Could a similar approach be used to automatically select the
 correct template based on active theme vs inactive theme, without
 overwhelming users with too many options?

 My idea is to automatically enable templates and template parts from
 inactive themes only if they meet the following criteria:

 * they are post-based rather than file-based (since these are unaffected
 by deleting the inactive theme)
 * they do not match any file in their own theme (since these are unlikely
 to be minor customisations that the user intended for that theme only)
 * they do not match any file-based or post-based slug in the active theme
 (since these will not mask anything from the active theme)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54838>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list