Add the following code to your theme’s functions.php file to remove the HREF attribute from all the links that link to “#”,

Basically can be very useful if you’re using submenus and you want the parent item unlinked, for example.

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 0 / 5. Vote count: 0

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?