[wp-trac] [WordPress Trac] #29461: Use get_registered_nav_menus() instead of $_wp_registered_nav_menus

WordPress Trac noreply at wordpress.org
Tue Sep 2 15:11:23 UTC 2014


#29461: Use get_registered_nav_menus() instead of $_wp_registered_nav_menus
----------------------------+-----------------------------
 Reporter:  nacin           |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Future Release
Component:  Menus           |     Version:  3.0
 Severity:  normal          |  Resolution:
 Keywords:  good-first-bug  |     Focuses:
----------------------------+-----------------------------

Comment (by jesin):

 I could only find 4 uses of `$_wp_registered_nav_menus` in **wp-includes
 /nav-menu.php**.

 1. `register_nav_menus()`
 2. `unregister_nav_menu()`
 3. `get_registered_nav_menus()`
 4. `has_nav_menu()`

 This variable is modified in 1 and 2. So the only valid change would be 4.
 I think
 [https://core.trac.wordpress.org/attachment/ticket/27735/27735.2.patch
 this patch] should do.

 I couldn't find other occurrences of `$_wp_registered_nav_menus`.

 {{{
 $grep -rn "\$_wp_registered_nav_menus" --exclude-dir=.svn src/ | cut -d':'
 -f1-2

 src/wp-includes/nav-menu.php:74
 src/wp-includes/nav-menu.php:78
 src/wp-includes/nav-menu.php:89
 src/wp-includes/nav-menu.php:91
 src/wp-includes/nav-menu.php:92
 src/wp-includes/nav-menu.php:93
 src/wp-includes/nav-menu.php:119
 src/wp-includes/nav-menu.php:120
 src/wp-includes/nav-menu.php:121
 src/wp-includes/nav-menu.php:145
 src/wp-includes/nav-menu.php:147
 }}}

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


More information about the wp-trac mailing list