Support » Plugin: Theme Check » False positive: Menu name is being used

  • Hi guys,

    I get this warning:

    REQUIRED: A menu name is being used for a menu in filename.php. By using menu name, the menu would be required to have the exact same name in the WordPress admin area. Use a theme_location instead.

    For this code:

    <?php
    
    wp_nav_menu( array(
    	'theme_location'  => 'primary',
    	'container'       => 'div',
    	'container_class' => 'menu',
    	'menu_class'      => 'menu',
    	'depth'           => 3,
    	'items_wrap'      => '<ul>%3$s</ul>',
    ) );

    I presume this is because I’m setting 'menu' as classes and 'menu' is also attribute of wp_nav_menu().

    I can not upload my theme update due to this, so I guess the best bet is to change the classes to something different.

    Funny enough, Theme Check (version 20200922.1) plugin I have installed on my server does not report this, only when I upload a theme update to WPORG, it throws this error. Maybe theme check on WPORG should be updated?

    Thanks and regards,

    Oliver

  • The topic ‘False positive: Menu name is being used’ is closed to new replies.