0

In my child theme I have top navigation and custom navigation (archive menu). When I add new page to archive menu, same page gets added to top nav. In the admin top nav doesn't show new page though,however, in the browser there's new page showing in top nav.

I unchecked 'Automatically add new top-level pages to this menu' in my top nav but it didn't help

  function archive_menu() {
  register_nav_menu('archive_menu',__( 'Archive' ));
}
add_action( 'init', 'archive_menu' );

output in index.php

<?php
  wp_nav_menu(

    array(
        'theme_location'=> 'archive_menu'
          
  )
);?>

Question: Is there a way to stop new page added to top nav and only have new page added to my archive nav.

BACKEND ADMIN

This is how my custom menu looks in the child theme admin

enter image description here

This is how my primary menu looks in the child theme admin

enter image description here

This is primary (top) nav in the browser (red arrow shows 'archive' menu item which gets added automatically even though I didn't add it in the admin).

enter image description here

5
  • " In the admin top nav doesn't show new page though,however, in the browser there's new page showing in top nav". Does this mean that the WP menu manager in the back-end does not show the menu item that is visible on the front-end? If so, add all of your wp_nav_menu and register_nav_menu to your question to help show the issue.
    – jdm2112
    Jun 27, 2020 at 18:55
  • Because I am using child theme the only code I used is the above wp_nav_menu and register_nav_menu code for my custom menu. My understanding is that primary menu is inherited from parent
    – 810311
    Jun 27, 2020 at 21:54
  • "Does this mean that the WP menu manager in the back-end does not show the menu item that is visible on the front-end? " Yes, the issue is when I add archive page to my custom menu in the admin, it gets added to the top nav when output in the browser however its not visible in the admin (I've added some screenshots to demonstrate the issue better).
    – 810311
    Jun 27, 2020 at 22:02
  • That is very strange. Have you looked at the slugs for the parent theme's menus? Maybe there is some overlap there.
    – jdm2112
    Jun 28, 2020 at 4:34
  • I just looked at the page slugs - they are the same both in parent and child theme localhost/mytheme-wp/blog localhost/mytheme-wp/about localhost/mytheme-wp/contact
    – 810311
    Jun 28, 2020 at 19:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.