A WordPress-centric search engine for devs and theme authors



unregister_nav_menu ›

Since3.1.0
Deprecatedn/a
unregister_nav_menu ( $location )
Parameters:
  • (string) $location The menu location identifier.
    Required: Yes
Returns:
  • (bool) True on success, false on failure.
Defined at:
Codex:

Unregisters a navigation menu location for a theme.



Source

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;
}