If you need to insert a parent link item in your menu with no link and your only solution is adding a link to hash “#”, paste this to your theme’s functions.php to remove the HREF attribute from the A (link) tag:

 

add_filter( 'wp_nav_menu_items', function ( $menu ) {
    return str_replace( '<a href="#"', '<a', $menu );
} );
 

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?