unregister_nav_menu( string $location )

Unregisters a navigation menu location for a theme.


Parameters Parameters

$location

(string) (Required) The menu location identifier.


Top ↑

Return Return

(bool) True on success, false on failure.


Top ↑

More Information More Information

Usage:
unregister_nav_menu( 'primary' );


Top ↑

Source Source

File: wp-includes/nav-menu.php

function unregister_nav_menu( $location ) {
	global $_wp_registered_nav_menus;

	if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[ $location ] ) ) {
		unset( $_wp_registered_nav_menus[ $location ] );
		if ( empty( $_wp_registered_nav_menus ) ) {
			_remove_theme_support( 'menus' );
		}
		return true;
	}
	return false;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.