fatal error in tags.php

728 viewsCorefatalerror tags
0

Hi.
Fatal error: Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, string given in /home/-/public_html/wp-content/plugins/anspress-question-answer/addons/tags/tags.php on line 150

in line 150: 

<code>$ap_max_num_pages = ceil( count( $tags_rows_found ) / $per_page );
</code>

$tags_rows_found is expected to be an array or an object that implements Countable, but it is getting a string instead.

The 'fields' => 'count' argument suggests that $found_query->get_terms() should return an integer representing the number of terms found matching the criteria, not an array, then the count() is redundant and incorrect in this context.

So line 150 must be:

<code>$ap_max_num_pages = ceil( $tags_rows_found / $per_page );
</code>
Asked question