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 does the ‘wp_nav_menu’ function work only 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
- WordPress wp_dequeue_script remove all other scripts
- Why nav_menu_css_class doesn’t work with apply_filters?
- Bizarre Child Menu Issue on WP Site
- Combine page types and Custom Taxonomy in a functions.php command
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Header menu aligned right on all pages except for single-post page [closed]
- Can’t load assets
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- 3 Level Menu Navigation (3rd Level not displaying)
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Is_Page doesnt detect my page
- Test CDN link from function.php or wp_enqueue_script/style?
- Can we have conditional CSS styling?
- CSS style and app.js not loading
- Post content overflows on my mobile phone
- Stylesheet does not load despite functions.php
- How to customize archive widget only for cpt?
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- How to automatically add counted number to navigation menu items?
- wp_title() return random number
- Why does echo on functions.php not yield result in source code?
- How do I make a custom “Read More Blogs” button for my blog page
- function class doesnt work
- Help using ShortCodes to style whole chunks of the post
- Combine multiple menus using the filter wp_nav_menu_items
- How to offset main query without affecting other queries and backend
- Setting Up Child Theme To Take Priority
- how to remove a tag in the_category function
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- Menu and category highlighting for a single post
- CSS disabled after getting rid of emoji
- WordPress Toggle Menu has stopped working
- Add meta data in head from theme
- How to add styles in existing function?
- what is `get_section()` and how to use it?
- Woocommerce – Switching Price for Category
- Adding a class to the body of an inactive site using multisite
- Conditionally apply css for a specific template part
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Child Theme not loading multiple stylesheets
- How can I stop the hook from breaking the login/logout function?
- How to retrieve image IDs from shortcode content?
- HowTo: Add wrapper to columns shortcode?
- How to add widget in main menu
- Correct way of Enqueue self hosted fonts in sass project
- How to create admin ajax function for my contact form
- Help with is_page() and calling css for specific pages in a Child Theme
- Class::$template_dir_path=get_template_directory();
- Child theme style.css didn’t work properly but the Customize Additional CSS did [closed]
- How to automatically add custom classes to headings in content area
- How to disable site title and description when custom header is uploaded on the customizer?
- Language Switch Function
- Insert menu into theme location depending on user logged in/out status
- Adding a meta box fields to child theme options page
- wordpress not calling peliegro functions.php?
- Language switcher for subdomains
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Adding custom field in menu options [duplicate]
- Load a Child Theme’s style.css just before the closing tag
- Modify sub_menu function to show pages below a specifically set page
- Changing the color of post title [closed]
- Preventing PHP Execution in Parent Theme
- Adding a filter with custom function to the menu / navigation
- Random text changing to weird icons in both admin & front end
- Functions.php in child theme that loads CSS file breaks website
- Allow tags and attributes in post and pages content
- theme options not saving
- Syling Custom Fields echo’s from from functions.php
- functions.php / replacing div’s with new ones?
- How to add a class name to the ancestor of a post?
- Function Reference for custom link in Admin Menu Management Page
- How do I get my nav menu to show sub pages?
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Add the title of a widget as an ID – for anchor links
- Hiding Google Analytics code based on theme options
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- How do I middle-align my header menu items in WordPress [closed]
- Image width issue in IE [closed]
- How to highlight current menu bar base on the URL?