Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to add a third level menu on WordPress. This is the code I've added to the functions.php file to create the secondary menu, but when trying to repeat the same code with a third menu, I get an error.

add_action( 'init', 'my_custom_menus' );
  function my_custom_menus() {
     register_nav_menus(
        array(
  'primary-menu' => __( 'Primary Menu' ),
  'secondary-menu' => __( 'Secondary Menu' ) 
share|improve this question

migrated from stackoverflow.com Feb 4 at 0:13

This question came from our site for professional and enthusiast programmers.

    
Do you see this wordpress.stackexchange.com/a/132155/9884 –  Brad Dalton Feb 9 at 13:51

1 Answer 1

Add a new item to the array like displayed below:

add_action( 'init', 'my_custom_menus' );
  function my_custom_menus() {
     register_nav_menus(
        array(
        'primary-menu' => __( 'Primary Menu' ),
        'secondary-menu' => __( 'Secondary Menu' ),
        'third-menu' => __( 'Third Menu' )
        ));
  }
share|improve this answer
    
Thank you for the answer, I've tried to do so, it's giving me an error. –  Ethan31 Feb 3 at 1:36
    
Than you are having problems somewhere else. if you post what's an error maybe you will get more help. Are you sure you are not duplicating function name? –  Aleksandar Đorđević Feb 3 at 7:10
    
@Ethan31 What kind of "Error"? Errors have messages, which provide the needed information to help you. –  kaiser Feb 9 at 12:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.