0

I'm a backend dev learning WordPress for the first time. I'm trying to create a menu in the admin GUI, but the menu isn't displaying all of the items that it should.

As you can see, the menu is configured to display two pages and three posts. Picture of menu config

But it actually only displays links to the two pages. The links to the three posts are missing. enter image description here

The code that renders the menu is as simple as it gets.

<?php wp_nav_menu( array( 'theme_location' => 'top-menu' ) ); ?>

So is the code that registers the menu.

<?php
function register_my_menus() {
  register_nav_menus(
    array(
      'header-menu' => __( 'Header Menu' )
     )
   );
}

add_action( 'init', 'register_my_menus' );
?>

Why on earth isn't this working???

2

Your menu name is not consistent.

When you created the menu, you named it 'header-menu'. But when you rendered it, you tried to render 'top-menu'. 'top-menu' doesn't exist; it needs to also say 'header-menu'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.