2

I'm trying to customize the default Wordpress menus. Added this to my functions.php file and it makes my menus disappear. What is wrong?

function custom_novice_menu($args) {
    $defaults = array(
        'container' => 'div'
    );
}

add_action('wp_nav_menu', 'custom_novice_menu');

Here is some documentation on wp_nav_menu()

2

I don't think there's wp_nav_menu action. Perhaps you want the wp_nav_menu filter (doc)?

function custom_novice_menu($args) {
    if( 'primary' == $args['theme_location'] ) // only apply to the right menu
    {
        $args['container'] = 'div';
    }

    return $args;
}

add_filter('wp_nav_menu', 'custom_novice_menu');

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.