最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

navigation - Misleading behaviour on Menu & Theme location

programmeradmin4浏览0评论

I've got the following usual menu registration function:

function my_register_menus(){
    register_nav_menus( array(
        'primary-menu' => __( 'Primary Menu', 'text_Domain' ),
        'footer-menu'  => __( 'Footer Menu', 'text_Domain' ),
    ) );
}

add_action( 'init', 'my_register_menus', 0 );

and this is what I call in my header.php:

wp_nav_menu( array( 'theme_location' => 'primary-menu' ));

Now, in the

WP Admin > Nav Menus

when I assign a menu to the primary-menu location, the menu doesn't show at all in the theme.

If I un-check the menu location, the menu appears.

发布评论

评论列表(0)

  1. 暂无评论