[wp-trac] [WordPress Trac] #40221: switch_theme action + Live Preview = confusion

WordPress Trac noreply at wordpress.org
Tue Mar 21 17:09:50 UTC 2017


#40221: switch_theme action + Live Preview = confusion
--------------------------+-----------------------------
 Reporter:  alexvorn2     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  4.7.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The switch_theme function has inside a hook named the same: switch_theme,
 it is used for theme deactivation actions, but the problem is that after
 you activate the theme via Live Preview - this action is executed, so can
 create confusion.

 (switch_theme hook is for theme deactivation functions -
 https://codex.wordpress.org/Plugin_API/Action_Reference/switch_theme)

 When we activate a theme (not via Live Preview) - then this hook is
 executed together with old theme, not with new theme, but when we have a
 Live Preview with a new theme, then this hook will be used with the theme
 that is inside the Live Preview, with it's files. That's why this hook is
 called incorrectly.

 So if this is not by design and it is a bug then the fix would be to skip
 this hook after a theme activation via Live Preview.

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


More information about the wp-trac mailing list