0

The menus have been registered in functions.php, but they don't appear within the Appearance > Menus section in Admin and the pages, posts etc options are greyed out.

The menus are saved, as you can not create the menu with the same name again.

Greyed out Menu options

Within functions.php:

function theme_setup() {
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'html5', array( 'search-form' ) );
    /*** Register Menus */
    if (function_exists('register_nav_menus'))
    {
        register_nav_menus(
        array(
            'main-menu'         => __( 'Main Menu', 'site' ),
            'footer-menu'       => __( 'Footer Menu', 'site' ),
            )
        );
    }
}
add_action('after_setup_theme', 'theme_setup');

Within header.php

wp_nav_menu(
                array(
                    'menu'          => 'Main Menu',
                    'container'     => '',
                    'depth'         => 1,
                    'theme_location' => 'main-menu',
                )
            );

Within footer.php

wp_nav_menu(
                array(
                    'menu'          => 'Footer Menu',
                    'container'     => '',
                    'items_wrap'    => '',
                    'theme_location' => 'footer-menu'
                )
            );

The main issue here is that these menus exist and are rendering out on the site, but they seem to be hidden within the admin panel and if a new menu is created it never shows up.

Using Wordpress version 4.7 (Latest)

Plugins: Current plugins

What could be causing this?

0

There's nothing wrong with your theme_setup() function in your functions.php file.

The error you get simply points out the fact that the menu name Main Menu already exists.

In other to resolve this you should replace your Main Menu menu name definitions in your functions.php file with something other than what it currently is.

It's possible you might be using a theme or a plugin which already has a menu name registered as such, accounting for the current menu name conflict.


Update:

Your code works well. I think your challenge has to do with registered menu location vs actual menu (form the dashboard, as actual menus to be rendered into a given registered menu location).

What you should do: type inside the "Menu Name" input box as seen on you first shared screenshot a new menu name, then, click on the "Create Menu" button; your custom registered menu locations will then be visible as seen in the screenshot below:

Newly created menu (stacktest)

  • Thank you, further to this - the menus exist and are rendering out on the site, but they seem to be hidden within the admin panel and if a new menu is created it never shows up. I don't believe there are any plugins which have menu conflicts. – mixchex Jan 6 '17 at 12:00
  • Noted @mixchex; you may consider updating the OP with that detail so as to clarify further the nature of the challenge you are facing. BTW: what is the outcome when using a menu name and definition other than the current Main Menu in your theme_setup() function? – nyedidikeke Jan 6 '17 at 12:05
  • Thank you @nyedidikeke. The information has been added. I have changed both name definitions and this has no difference unfortunately. – mixchex Jan 6 '17 at 12:13
  • What version of WordPress are you using? Are you editing a WordPress theme from the WordPress Directory, a commercial or a custom one? What are the current active plugin you have on your WordPress installation instance? – nyedidikeke Jan 6 '17 at 12:25
  • OP updated. Wordpress 4.7 and plugins screenshot added. – mixchex Jan 6 '17 at 12:31
0

UPDATE:

The issue was caused by the WPCoreSys plugin. Not sure of its purpose.

Something which was in the plugin had a conflict and stopped the menu editor from working.

The plugin was not visible within the Plugins section, but it was present within the file directory. As it was not active, it was removed and now the menu area functions as expected.

  • FYI, this is a virus/backdoor. You were hacked. It adds other backdoors so that even if you deleted this the hacker could get back in whenever they like again. Just dealing with this for someone now. It modifies core WP files, theme files like you header.php and tracks stuff in the DB. On the site I was looking at they'd managed to changed the admin login and other users passwords. I'm lucky that I can blow away the site and it's not too bad to start from scratch, but otherwise it's a pretty manual cleanup. More info: sarn.phamornsuwana.com/wpcoresys-dolly-hack – benmccallum Apr 6 at 13:13

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.