[wp-trac] [WordPress Trac] #39692: Fix missing assignment of menus on theme switch

WordPress Trac noreply at wordpress.org
Mon Apr 3 23:22:45 UTC 2017


#39692: Fix missing assignment of menus on theme switch
-------------------------------------+-----------------------
 Reporter:  melchoyce                |       Owner:
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.8
Component:  Menus                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------

Comment (by westonruter):

 As for the menu groups, from this data I think that `header` should be
 included in the primary group.

 Also, the string comparisons should be changed to be case-insensitive, and
 also to explicitly check for `false` as `strpos()` can return `0` if the
 haystack string begins with the needle string. So something like so:

 {{{
 if ( false !== stripos( $location, $slug ) || false !== stripos( $slug,
 $location ) ) {
 }}}

 Then we need to figure out how to apply these changes up-front when
 opening the customizer to preview theme switch. When the customizer is
 used for theme switching, we should presume that the nav menu locations
 will be assigned during the customization session. So as with starter
 content, the customizer should open with the nav menu location settings
 already dirty and populated with the remapped nav menus, and so they
 shouldn't be changed when the new theme then gets active.

 Also, if a theme was previously active, then it will already have nav menu
 location assignments in its theme mods. In that case, I think this menu
 remapping switching logic should only be done if the target theme has no
 stored nav menu location assignments already.

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


More information about the wp-trac mailing list