This is due to the wp_nav_menu
parameter fallback_cb
:
If the menu doesn’t exist, a callback function will fire. Default is ‘wp_page_menu’. Set to false for no fallback.
You have not specified an alternative, so it uses the default, wp_page_menu
.
You could create your own function to display a page menu with the proper markup, or set the fallback_cb
parameter to false
and display nothing.
has_nav_menu
might also be helpful for displaying alternate markup when a menu isn’t available.
Related Posts:
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- How to add background image control to page admin controls?
- Is there a way to add a class to non current menu item?
- Redirect to another page using contact form 7? [closed]
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Functions php shortcode for displaying main menu with no child items
- Nav menus all outputting the same links
- Show some menu sub items as dropdown under a menu item
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- Default Nav Highlight
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- wp_nav_menu work in functions.php but not in the theme
- current_page_item is missing inside wp_nav_menu
- define css class in functions.php
- Advanced method to control cache of enqueued style/script
- wp_nav_walker that interacts with widgets to setup mega menu
- wp_nav_menu, walker class, categories as classes of li
- Hard-coding custom menu elements for menu manager
- Use register_setting() in a loop
- Best practices regarding the creation of custom widgets?
- WordPress Menuing Question :focus
- Add dynamic links in WordPress custom theme
- WordPress menu link doesn’t work properly
- Search filter by Post title OR Meta Title Value [duplicate]
- change the url paths in the stylesheet dynamically
- how can I edit flexslider in woocommerce. [Urgent]
- Custom Nav Walker sub-menu
- How to fetch the name of the active menu?
- admin-ajax.php + load-scripts.php hanging for minutes
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- enqueue styles for only mobile wp
- Jquery implementation not working on page reload
- Replace a menu with widget or a custom template file programmatically
- Following Web Performance Optimization techniques to output static and dynamic css
- Unique sequential reservation code
- Categories as main menu items and subcategories as nested lists
- How to disable wordpress from overload my stylesheet styles with customizer styles
- Generating dynamic css into custom file [closed]
- Usage of theme name in functions
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Functions.php Problem
- Change CSS for logged in users
- Removing specific menu items?
- Option Tree integration of Custom CSS
- ACF not showing
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- How to stop wordpress from injecting hard-coded style into image attachments with captions
- different style sheet for just one page template
- How do I use a color from theme options?
- Custom styles.css sheet for visual editor
- How to Create custom xml file for demo content for custom theme?
- Is my code correct to enqueue CSS on a specific page?
- Control the srcset much more (not all sizes in it each time)
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- header_image() with CSS
- Remove Custuomize Sections
- Can we create our own theme’s function.php?
- Not all CSS elements transferring via parent to child?
- Define PHP variable from a seperate API if statement
- How do I hook into the container of wp_nav_menu?
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- Split Media Queries in different files!
- JQuery undefined and Stylesheet loads in bottom along with js files
- Turn get_posts as string into an array for use in theme admin options
- New custom menu created. how to apply it?
- problem loading stylesheets to wp_head dynamically
- Apply styles to blockquote element with the WYSIWYG editor
- Dropline menus — seperators between children only?
- Filter nav menu items HTML tags and wrap inner text with span
- Does size of a theme’s functions.php file matter?
- retrieves menu and converts it to a readable array
- get_next_posts_link() returns no result despite available posts
- Secondary Menu and Logged In Users
- Change menu based on page template via functions.php
- PHP 7.1 | Warning: A non-numeric value encountered in
- How to add custom li item to wordpress menu
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Parent theme styles overriding child theme CSS [closed]
- $_Get and &_REQUEST Index Undefined on Functions.php
- Theme JS is available but theme CSS isn’t
- Proper Way to Load stylesheet on Condition
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- Getting the teaser text without overriding global variables
- Combine two active_callbacks into one on theme customizer
- why is this function firing on all child menu items as well?
- WP Customizer API loaded into functions.php
- Custom styles in Tiny MCE with an external CSS file
- Adding theme option values as custom body class
- How to modify mobile nav menu text in theme
- get_template_directory_uri() links to child theme not parent
- Different methods of adding menu support to custom theme
- “options.php” not found
- Adding a section in line at the end of the main navigation menu in php
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- How to add aria role and schema markup to custom walker container