I am trying to learn more on Theme Development so I've created my own and everything worked fine except when I added functions.php and tried to update it with something simple as:

 add_theme_support('admin-bar', array('menus'));

I get Server 500 ERROR and I cannot access any part of Wordpress, not even Dashboard. But then as soon as I delete functions.php and refresh page my Wordpress is back again and working smooth.

What is so mysterious about functions.php????

Thank you so much.


Error 500 is very generic and can be caused by numerous underlying issues. Your first step should be locating error log for your hosting account or asking support to help with that.

My weak guess would be that your file gets created with file permissions that are not secure enough to hosting configuration.

  • upon creating file i executed sudo chmod 777 -R wordpressDirectory to enable write permissions. you think it has something to do with that?? – daniel.tosaba Mar 15 '12 at 20:00
  • btw it is localhost Wordpress configuration that I am running :))) – daniel.tosaba Mar 15 '12 at 20:02
  • @daniel.tosaba it might or might not. As above that is merely first thing I would check if I don't have better idea from error log. – Rarst Mar 15 '12 at 20:02
  • sorry I am not very skilled with linux file permissions. do you have better number for me so i can quick check it?? many many thanks. – daniel.tosaba Mar 15 '12 at 20:03
  • 1
    @daniel.tosaba I am not sure what you are trying to do there (I don't recognize admin-bar argument) and it's not relevant to error issue this question is about - ask new one about that? On your error issue you should probably enable WP_DEBUG to catch errors. – Rarst Mar 15 '12 at 20:21

Your add_theme_support() call syntax is incorrect. It should be:

add_theme_support( $feature, $callback )

Where $feature = 'admin-bar', and $callback = 'callback_function_name'

Have you defined a callback?

More importantly: are you absolutely sure you even need to enable Theme support for this feature? It is only required for overriding the default behavior of the admin toolbar.


To add Theme support for navigation menus, you need to add a separate call to add_theme_support(). But really, you don't need to call add_theme_support() directly for custom navigation menus. Simply call register_nav_menus(), and WordPress will handle adding Theme support. e.g.:

register_nav_menus( array(
    'primary_menu' => 'Primary Menu',
    'footer_menu' => 'Footer Menu'
) );

So, putting those together (and properly wrapping them in a callback):

function wpse45721_theme_setup() {

    // Add Theme Admin Bar OVerride SUpport
    add_theme_support( 'admin-bar', 'wpse45721_admin_bar_cb' );

    // Add Theme Support For Custom Nav Menus
    register_nav_menus( array(
        'primary_menu' => 'Primary Menu',
        'footer_menu' => 'Footer Menu'
    ) );

add_action( 'after_setup_theme', 'wpse45721_theme_setup' );

function wpse45721_admin_bar_cb() {
    // What goes here is up to you
  • Thanks Chip!! That is valuable piece of information for future reference. Appreciated!! – daniel.tosaba Mar 15 '12 at 20:52

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.