Deleted Page doesn't delete item from Nav Menu


In my theme, I have the following code in header.php to display my top nav menu:

<?php wp_nav_menu(array('theme_location'=>'primary','menu_id'=>'suckerfishnav','container'=>'div','container_class' => '','menu_class'=> 'suckerfishnav'));?>

Under Appearance -> Menus, I have a nav menu named "Main menu" which is assigned to the Main Menu. The issue is when I delete a page under the "Pages" section, the Main menu still shows that item on my site which if I click it, it generates a 404 error.

How can I have the menu remove an item once that page is put in trash?



  • dunskii
    • Site Builder, Child of Zeus

    Hi SW,
    To remove a page from a menu try the following
    Appearance -> Menus -> Main Menu (Looks like you know that part)
    Then click on the down arrow on the right end of the box that shows the page name you want to delete
    The box will expand and show extra details like nav title etc,
    In the bottom left corner it say "Remove" in red
    Click on that -> confirm and your done
    Hope that helps,

  • stevewest15
    • Flash Drive

    Hi D,

    I'm aware of how to manually remove a page from a menu. My question is why doesn't WordPress automatically remove the item from the menu when the page is placed in trash? For example, if I use the "Twenty Eleven" theme, when pages are deleted, the menu item is automatically deleted. How do I get this feature into my custom theme?



  • aecnu
    • WP Unicorn

    Greetings SW,

    Just checking if this issue was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thank you for being a WPMU Dev member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.