WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 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:

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 5 years ago.
nav-menu.php.15288.2.patch (837 bytes) - added by jorbin 5 years ago.

Download all attachments as: .zip

Change History (11)

@jorbin5 years ago

comment:1 @jorbin5 years ago

(cut off above)

That the parent has registered.

comment:2 @nacin5 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.

comment:3 @nacin5 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.

comment:4 @jorbin5 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

comment:5 @jorbin5 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.

comment:6 @jorbin5 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

comment:7 @westi5 years ago

  • Milestone changed from Awaiting Triage to 3.0.1

Candidate for 3.0.1

comment:8 @nacin5 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.

comment:9 @ryan5 years ago

[15466] for 3.0.1

Note: See TracTickets for help on using tickets.