为什么我的WordPress菜单项显示了它们链接到的页面?

发布于 2025-02-13 01:35:55 字数 546 浏览 0 评论 0原文

我正在添加一个自定义菜单,使用此代码注册菜单:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文