boolval() is a PHP function that was introduced in PHP 5.5. If you try to use it on a server that runs PHP 5.4 and lower, you will get an error like this:
Fatal error: Call to undefined function boolval() in /path/to/file/file.php on line 12
To fix this error, add the following to your WordPress theme’s functions.php
/**
* Get the boolean value of a variable
*
* @param mixed The scalar value being converted to a boolean.
* @return boolean The boolean value of var.
* @refer http://php.net/manual/en/function.boolval.php#114013
*/
if( !function_exists('boolval')) {
function boolval($var){
return !! $var;
}
}
Let me know if that helps.
Thank you very much! This fix saved me time, money and a lot of aggravation. Cheers!
Perfect. Glad to hear that Scott 🙂
Thanks mate.
This worked. Saved me hours of messing with around.
Muchas gracias…funciono perfecto.
Thanks a lot…a perfect solution!!!
Regards from Mexico
Arun, the code you supplied worked perfectly and I had my site up and running again within seconds. Thank you so much as I appreciate your support. If there is anything I can do to spread the good word and help you, please let me know. Thank you again. -Joseph