body_class giving php error caused by invalid parameters for join()
-
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_classget_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?
- The topic ‘body_class giving php error caused by invalid parameters for join()’ is closed to new replies.