plugins – WordPress menu dissapear when I add a parameter to custom post archive


If I view the page /custom_archive/ -> the menu shows up correctly

But if I view the page /custom_archive/?custom_param=1 only the Homepage item from the menu shows up.

This looks like there is a filter somewhere that is doing something… or there is a bug

Here is how I get my items on the archive page :

    $menuLocations = get_nav_menu_locations();
    $menuID = $menuLocations['my_menu_location']; 
    $primaryNav = wp_get_nav_menu_items($menuID);

So why does sometimes work and sometimes not, and how I can make this always return the same menu?

I’m guessing there is a filter out there in get_posts via wp_get_nav_menu_items that is causing this behavior. Most likely from a plugin.

iulian.flester 2 months 2023-03-27T14:47:34-05:00 0 Answers 0 views 0

Leave an answer