您在之前的链接中使用死链接(#)的问题。您可以在之前测试从link\\u中删除“#”
<ul class="navbar-nav mr-auto">
<?php
wp_nav_menu(array(
\'theme_location\' => \'headerMenuLocation\',
\'before\' => \'<class="nav-item active">\',
\'menu_class\' =>\'navbar-nav mr-auto\',
// \'link_before\' =>\'<a class="nav-link" href="#">\',
//problem is here {href="#"}
// \'link_after\' =>\'<span class="sr-only">(current)</span></a>\',
\'container\' => false,
\'items_wrap\' => \'%3$s\'
));
?>
</ul>