wp_nav_menu_disabled_check

Check whether to disable the Menu Locations meta box submit button.

Description

(string) wp_nav_menu_disabled_check( (int|string) $nav_menu_selected_id ); 

Returns (string)

Disabled attribute if at least one menu exists, false if not

Parameters (1)

0. $nav_menu_selected_id (int|string)
(id, name or slug) of the currently-selected menu

Usage

  1. if ( !function_exists( 'wp_nav_menu_disabled_check' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/nav-menu.php'; 
  3.  
  4. // (id, name or slug) of the currently-selected menu 
  5. $nav_menu_selected_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_nav_menu_disabled_check($nav_menu_selected_id); 
  9.  

Defined (1)

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

/wp-admin/includes/nav-menu.php  
  1. function wp_nav_menu_disabled_check( $nav_menu_selected_id ) { 
  2. global $one_theme_location_no_menus; 
  3.  
  4. if ( $one_theme_location_no_menus ) 
  5. return false; 
  6.  
  7. return disabled( $nav_menu_selected_id, 0 );