WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/has nav menu

Contents

Description

Returns boolean Whether a registered nav menu location has a menu assigned(true) or not(false).

Usage

 <?php
if ( has_nav_menu$location ) ) {
     
//Do something
?> 

Parameters

$location
(string) (required) A string of menu location slug.
Default: None

Return Values

bool True if the registered location has a menu assigned, false otherwise.

Changelog

Source File

Related

Navigation Menu: register_nav_menus(), register_nav_menu(), unregister_nav_menu(), has_nav_menu(), wp_nav_menu(), wp_get_nav_menu_items()

See also index of Function Reference and index of Template Tags.