WordPress “Warning: Missing argument 2” errors

I’ve got 2 super specific ‘missing argument 2’ errors going on. In localhost it’s all good, but once I’ve put the whole thing online it’s returning these errors:

A) Warning: Missing argument 2 for add_category_to_single() in /home/content/23/9090823/html/extranet/printedcrush/wp-content/themes/facepress/functions.php on line 89

Read More

Code:

add_filter('body_class','add_category_to_single');
    (line 89) function add_category_to_single($classes, $class) {
        if (is_single() ) {
            global $post;
            foreach((get_the_category($post->ID)) as $category) {
                $classes[] = $category->category_nicename;
            }
        }
    return $classes;
}

B) Warning: Missing argument 2 for my_class_names() in /home/content/23/9090823/html/extranet/printedcrush/wp-content/themes/facepress/functions.php on line 100

Code:

add_filter('body_class','my_class_names');
    (line 100) function my_class_names($classes, $class) {
    if (is_single() ) {
        global $post;
        foreach((get_the_category($post->ID)) as $category) {
            $classes[] = $category->category_nicename;
        }
    }       
    if (! ( is_user_logged_in() ) ) {
        $classes[] = 'logged-out';
    }
    return $classes;
}

Does anybody know how could I have these errors fixed?
Thanks in advance. 🙂

Related posts

Leave a Reply

1 comment