Viewing 1 replies (of 1 total)
  • Peter Featherstone

    (@peterfeatherstone-1)

    Hi there,

    I believe, you can do this by filtering the WordPress built in function wp_get_nav_menu_items():

    https://developer.www.ads-software.com/reference/functions/wp_get_nav_menu_items/

    I just found the below function after a very quick Google search from this page:

    https://wordpress.stackexchange.com/a/31753/103732

    function wpse31748_exclude_menu_items( $items, $menu, $args ) {
        // Iterate over the items to search and destroy
        foreach ( $items as $key => $item ) {
            if ( $item->object_id == 168 ) unset( $items[$key] );
        }
    
        return $items;
    }
    
    add_filter( 'wp_get_nav_menu_items', 'wpse31748_exclude_menu_items', null, 3 );

    I’ve never done this before so can’t say if it works but it looks promising.

    The easiest way of course is just to use some CSS to hide the item based on this menu ID.

    Let me know how you get on!

    Peter

Viewing 1 replies (of 1 total)
  • The topic ‘remove reponsive menu link ids’ is closed to new replies.