WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#14001 closed enhancement (fixed)

Menu Locations should be unregisterable by child themes

Reported by: jorbin Owned by: jorbin
Milestone: 3.0.1 Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords:
Focuses: Cc:
PR Number:

Description (last modified by nacin)

Right now there is no function to unregister menu locations. This means that child themes can't unregister a menu location that the parent has registered.

Attachments (2)

nav-menu.php.15288.patch (702 bytes) - added by jorbin 10 years ago.
nav-menu.php.15288.2.patch (837 bytes) - added by jorbin 10 years ago.

Download all attachments as: .zip

Change History (11)

#1 @jorbin
10 years ago

(cut off above)

That the parent has registered.

#2 @nacin
10 years ago

  • Milestone changed from Unassigned to 3.1

It should return true/false based on success.

We haven't decided on what 3.1 will look like yet, which would in turn affect what we end up backporting to 3.0.1 (whether it'll be more than just blockers). Seems fine for 3.1 for now.

#3 @nacin
10 years ago

  • Description modified (diff)

I wish I had thought of this function when I wrote those originally. I had written remove_theme_support in 3.0 as well, and this one is sorely missing.

#4 @jorbin
10 years ago

This was an oversight and while I would like for it to get in 3.0.1, but will also understand if 3.0.1 is a blocker/security only release.

I've updated it to return a bool value

#5 @jorbin
10 years ago

I also added an is_array check since if it's called before any menu is registered, $_wp_registered_nav_menus won't be an array yet.

#6 @jorbin
10 years ago

There seemed to be some momentum and discussion on moving this into 3.1 for sure and potentially 3.0.1. If it doesn't go in 3.0.1, I think a wpdevel post linking to or using the code I put out at http://aaron.jorb.in/blog/2010/06/how-to-remove-a-nav-menu-location-in-wordpress-3-0-0/ would be beneficial for child theme devs.

https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2010-06-24#m155929

#7 @westi
9 years ago

  • Milestone changed from Awaiting Triage to 3.0.1

Candidate for 3.0.1

#8 @nacin
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15467]) Add unregister_nav_menu(). props jorbin, fixes #14001 for 3.1.

#9 @ryan
9 years ago

[15466] for 3.0.1

Note: See TracTickets for help on using tickets.