• Resolved danielwerner23

    (@danielwerner23)


    Hi there, currently i’am using the default nav walker to build my header navigation. In this menu i do have a empty nav point in depth 0. This menu item isn’t cklickable, because the href is empty. Thats fine. But google lighthouse decreased the seo points, because its a empty a-tag. My plan is to remove the tag with a simple span-tag. But how? The default nav walker always a fixed a-tag.

    Solution a) is to use a preq_replace in my functions.php. Solution b) is to use a custom nav walker. Solution c) is to use a “#” and disable the click event (with js or css). Is there a “best way to go” solution?

    Bye and thanks

Viewing 1 replies (of 1 total)
  • Thread Starter danielwerner23

    (@danielwerner23)

    I’ve choosed the solution to disable the click with js and/or css:

    document
    	.querySelectorAll('#menu-header-menue a[href="#"]')
    	.forEach(function (element) {
    		element.addEventListener('click', function (event) {
    			event.preventDefault();
    		});
    	});
    .menu-item-type-custom > a
    @apply pointer-events-none
Viewing 1 replies (of 1 total)
  • The topic ‘Replace empty a-tags in nav walker’ is closed to new replies.