为什么我的WordPress菜单项显示了它们链接到的页面?
我正在添加一个自定义菜单,使用此代码注册菜单:
add_action( 'after_setup_theme', 'register_custom_menu' );
function register_custom_menu() {
register_nav_menu( 'primary', __( 'Main Menu' ) );
}
此代码显示菜单:
<?php wp_nav_menu( array(
'theme_location' => 'header-menu',
'container_class' => 'header-menu',
) );
?>
问题:
菜单已注册。我可以创建它。我可以保存。它在网页上显示。
它不会显示链接到的页面。地址栏将显示,例如“ http:// localhost:8888/sample-page/”,但它没有显示该页面,而是在主页上。
没有错误消息。
我在哪里开始寻找问题?
I'm adding a custom menu, using this code to register the menu:
add_action( 'after_setup_theme', 'register_custom_menu' );
function register_custom_menu() {
register_nav_menu( 'primary', __( 'Main Menu' ) );
}
And this code to display the menu:
<?php wp_nav_menu( array(
'theme_location' => 'header-menu',
'container_class' => 'header-menu',
) );
?>
The Problem:
The menu is registered. I can create it. I can save it. It displays on the web page.
It does not display the page to which it is linked. The address bar will show, for example, "http://localhost:8888/sample-page/" but it isn't displaying that page, it stays on the home page.
There are no error messages.
Where do I start to look for the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论