Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Customizer API Native WordPress Customizer Settings Navigation Settings in the Theme Customizer

"Menus" option not changing to "Change Your Menus" when amending functions.php file.

On video 7 in the Native WordPress customizer settings section Zac suggests that the following code is added to the functions.php file:

    $wp_customize->get_section('nav')->title = __('Change Your Menus', 'wptthemecustomizer');

He adds this code on the video and I follow. He refreshes his page on the customizer screen and his text for Menus changes to "Change Your Menus". Mine, when refreshed still says "Menus". In fact, I don't appear to have anything in my functions.php file relating to menu's at all so I'm not sure where this is coming from. Is this some default behaviour and my settings are being ignored? I know that the WordPress settings are changing quite a bit recently surrounding the customization screens so it might just be because the video is now out-of-date.

Hope someone can clarify why this isn't working for me please.

Many thanks.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,247 Points

To confirm, having now moved onto the next videos in the course over to video 2.8 I think we can confirm this is the case.

Glenn Basgaard
Glenn Basgaard
7,987 Points

I've been scouring my var_dump( $wp_customize ) looking for the title for nav or menu or nav_menu or whatever else it may have changed to in recent WP updates, but can't seem to find anything. Has anybody solved this issue yet?

5 Answers

Glenn Basgaard
Glenn Basgaard
7,987 Points

I found a solution. Don't know if it's 100%. All I know is that I finally got to change the name. It doesn't work for the Creating Custom Panels video later on in these lessons, but it's sufficient for this part. This is what I wrote:

$wp_customize->get_panel('nav_menus')->title = __('Change Your Menus', 'wptthemecustomizer');

Hi James,

Have you managed to get this working?

I have a lot of trouble with this course till I went into incognito mode with chrome, my cache was always needing to clear before these changes would show on the front end making me think I had done something wrong when I had not.

You are correct there have been many changes to WordPress of late but I had a quick wizz around the codex on this subject and seems good.

If you havnt solved it let me know :)


Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,247 Points

What confuses me about this part is when I add my Long and Short Menus the option in the Customizer doesn't change to "Navigation", and stays at "Menus".

I'm guessing this is simply a change in how this works in Wordpress 4.4 to the one Zac was using because I can go into the relevant settings and save them... the change them rather than just having in one simple dropdown list. Actually that one is found under a setting called Menu Locations.

Then when I add the line Zac suggests,

    $wp_customize->get_section('nav')->title = __('Select Menu', 'wptthemecustomizer');

I get the following error inside the customizer

Warning: Creating default object from empty value in C:\xampp\htdocs\wp-custom\wp-content\themes\wp-themecustomizer\functions.php on line 33

I wonder if this is the same with anyone else and if anyone knows of a fix. :-)

David King
David King
720 Points

I'm having this issue

getting this error: Warning: Creating default object from empty value in C:/

I haven't tried since to get it to work as I tried another course on logo design instead. I'll have a play around with another theme and see if I can get it working elsewhere instead and then revisit it.

If I'm honest, I don't learn particularly well by just copying and pasting the code in.. I'd rather write it from scratch and follow so I can understand how it builds up and where I make mistakes. If you just blindly paste things in, I often wonder how they work.

16,732 Points

This is really late for the above students, but I had the same problem and found this. add_action( 'customize_register', function( $wp_customize ) { $nav_menus_panel = $wp_customize->get_panel( 'nav_menus' ); if ( $nav_menus_panel ) { $nav_menus_panel->title = '...'; }

}, 100 );

I added it after this code on my line 83 in functions.php file: add_action( 'customize_register', 'wpt_register_theme_customizer' );

Website referenced: https://wordpress.org/support/topic/customizer-how-to-modify-menus-and-widgets-sections/ - Weston Ruter - It still didn't let me move the panel (note: it was not a section in my version of Wordpress) to another panel, which I haven't figured out, but this is a start to changing the Navigation / Menus panel name to what you want. In regards to moving this to the general_settings, a contributor on another site stated that you cannot move panels to another panel, but could move the contents of one panel to another, so maybe this is a start. http://wordpress.stackexchange.com/questions/245857/wordpress-customize-move-menus-options-field-to-another-section (there may be a better solution to all this, but this is the info I have found so far researching online)