I have a WooCommerce WordPress Theme installed.
I'm getting an error that public users can see, So I need to fix it ASAP.
The error is shown on all products pages, Here is the error:
Warning: sizeof (): Parameter must be an array or an object that implements Countable
Here is the related code:
global $product, $post, $smof_data; $cat_count = sizeof(get_the_terms($post->ID, 'product_cat')); $tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
The error is from the last line of the above code.
I could do something like checking if that
get_the_terms($post->ID, 'product_tag') is an array first, Else assign it to empty
'' or 0.
But not sure if this would affect other code.
How to solve this issue without affecting any other related code?