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

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

Let us improve this post!