{"id":17683577,"date":"2024-04-12T21:49:25","date_gmt":"2024-04-12T21:49:25","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/count-function-error\/"},"modified":"2024-04-12T21:49:25","modified_gmt":"2024-04-12T21:49:25","slug":"count-function-error","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/count-function-error\/","title":{"rendered":"count function error"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">hi,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fatal error<\/strong>: Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, string given in line 150 of wp-content\/plugins\/anspress-question-answer\/addons\/tags\/tags.php!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">the line 150 is:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$ap_max_num_pages = ceil( count( $tags_rows_found ) \/ $per_page );<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I changed it to:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><div class=\"code\"><pre>&lt;span class=\"hljs-variable\" style=\"color: var(--cib-color-syntax-blue); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;$ap_max_num_pages&lt;\/span&gt; = &lt;span class=\"hljs-title function_ invoke__\" style=\"color: var(--cib-color-syntax-purple); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;is_countable&lt;\/span&gt;(&lt;span class=\"hljs-variable\" style=\"color: var(--cib-color-syntax-blue); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;$tags_rows_found&lt;\/span&gt;) ? &lt;span class=\"hljs-title function_ invoke__\" style=\"color: var(--cib-color-syntax-purple); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;ceil&lt;\/span&gt;(&lt;span class=\"hljs-title function_ invoke__\" style=\"color: var(--cib-color-syntax-purple); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;count&lt;\/span&gt;(&lt;span class=\"hljs-variable\" style=\"color: var(--cib-color-syntax-blue); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;$tags_rows_found&lt;\/span&gt;) \/ &lt;span class=\"hljs-variable\" style=\"color: var(--cib-color-syntax-blue); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;$per_page&lt;\/span&gt;) : &lt;span class=\"hljs-number\" style=\"color: var(--cib-color-syntax-blue); font-variation-settings: var(--cib-type-subtitle1-font-variation-settings);\"&gt;0&lt;\/span&gt;; <\/pre><\/div><div class=\"code-footer\"><\/div><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Update it better please!<\/p>\n","protected":false},"template":"","class_list":["post-17683577","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17683577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17683577\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17683577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}