i’ve a problem with WordPress. This is the error message: PHP 7.2 Warning count(): Parameter must be an array or an object that implements Countable /web/htdocs/www.firenzeflowershow.com/home/wp-content/themes/wpex-elegant/functions/meta/init.php on line 750
> elseif ( is_array( $meta_box['pages'] ) && count( $meta_box['pages']
> === 1 )) $type = is_string( end( $meta_box['pages'] ) ) ? end( $meta_box['pages'] ) : false;
3
Answers
Please try if this works:
Try:
Your code did not work because
=== 1
was inside thecount()
function call:count($meta_box['pages'] === 1)
, and a comparison returns abool
. Here, I have changed it tocount($meta_box['pages']) === 1
which gets the number of elements in the array, and checks if it returns 1.The closing parenthesis of count is in the wrong position. You are actually passing a boolean to the function, because "$meta_box[‘pages’] === 1" will return true or false. Your code should be: