Here is the line of code I use to disable the top, or parent, links in a navigation menu in a WordPress site.
Insert this line of code into your header.php file, right before the closing <head> tag:
<script type="text/javascript">jQuery(function($) { $("li.page-item-7").children("a").attr('href', "javascript:void(0)");});</script>
Now, simply change the page-item-7 to the ID of the page that you wish to disable. If you want to disable more than one of the parent menu items, use this code:
<script type="text/javascript">
jQuery(function($) {
$("li.page-item-7,li.page-item-14,li.page-item-20,li.page-item-28").children("a").attr('href', "javascript:void(0)");
});
</script>
Let me know if you run into any issues or have any questions at all.
