unregister_nav_menu

Unregisters a navigation menu location for a theme.

Description

unregister_nav_menu( (string) $location ); 

Parameters (1)

0. $location (string)
The menu location identifier.

Usage

  1. if ( !function_exists( 'unregister_nav_menu' ) ) { 
  2. require_once ABSPATH . WPINC . '/nav-menu.php'; 
  3.  
  4. // The menu location identifier. 
  5. $location = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = unregister_nav_menu($location); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/nav-menu.php  
  1. function unregister_nav_menu( $location ) { 
  2. global $_wp_registered_nav_menus; 
  3.  
  4. if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[$location] ) ) { 
  5. unset( $_wp_registered_nav_menus[$location] ); 
  6. if ( empty( $_wp_registered_nav_menus ) ) { 
  7. _remove_theme_support( 'menus' ); 
  8. return true; 
  9. return false;