• I’m getting an error from /wp-includes/post-template.php:

    Warning: join() [function.join]: Invalid arguments passed in C:\xampp\htdocs\wordpress\wp-includes\post-template.php on line 390
    class=””>

    This is what it echos:

    <body <br />
    <b>Warning</b>:  join() [<a href='function.join'>function.join</a>]: Invalid arguments passed in <b>C:\xampp\htdocs\wordpress\wp-includes\post-template.php</b> on line <b>390</b><br />
    class="">

    As you can see it echos the class attribute correctly, but doesn’t echo any of the classes that it should add based on whatever page/article/category etc that you’re on.

    Here’s the line of php code causing the error (line 390 on post-template.php):

    function body_class( $class = '' ) {
    	echo 'class="' . join( " ", get_body_class( $class ) ) . '"';
    }

    It provides join() with ” ” for glue, and what should be an array of class names returned by get_body_class() for peices, but I’m assuming that function isn’t working properly, or something else is going wrong. I don’t think its user error on my part because I’m echoing body_class() exactly the same as is documented for that function.

    <body <?php body_class(); ?>>

    https://codex.www.ads-software.com/Function_Reference/body_class
    https://codex.www.ads-software.com/Function_Reference/get_body_class

    get_body_class() is on line 401 of post-template.php.

    I tried providing body_class() with a NULL parameter since that is supposed to be the default, and I noticed in the function that it’s default is an empty string, and I wasn’t sure if NULL == ”. But, to no avail.

    I also tried echoing get_body_class(), but that didn’t echo anything.

    Anyone have a fix?

Viewing 1 replies (of 1 total)
  • Moderator Dion Hulse

    (@dd32)

    Meta Developer

    It sounds like something is filtering on body_class and returning incorrectly.

    try doing var_dump(get_body_class()); and see if thats an array, you’ll probably find it’s a string or Object or similar.

    Try greping your plugins for a mention of body_class and see if theres a plugin filtering it? (or.. y’know, disable them all to check.. It could also be the theme as i’m not sure if this is a custom-written theme?)

Viewing 1 replies (of 1 total)
  • The topic ‘body_class giving php error caused by invalid parameters for join()’ is closed to new replies.