WordPress remove hyperlinks on parent menu item

In my php generated nav-menu I’d like to make parent items unclickable and not related to a page. I just want them to reveal children when hover.

PHP code generating the nav-menu:

<?php wp_list_pages('sort_column=menu_order&title_li='); ?>

I’d need to remove the href link in any element that has “page_item_has_children” as class.

Can’t use the “custum link” method because since my theme is made from scratch I don’t have access to that wp setting.

Read more here: WordPress remove hyperlinks on parent menu item

Leave a Reply

Your email address will not be published. Required fields are marked *