Initial assessment

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, … given

“count(): Argument #1 ($value) must be of type Countable|array” in WordPress: causes and what to check

Updated 2026-11-01

Since PHP 8.0, count() throws a TypeError when it receives something other than an array or a Countable object. PHP 7 only showed a warning, so older plugins and themes that count null or a string stop the site after a PHP upgrade.

Which of these do you see?

Code that ran with a warning on PHP 7 now stops with a fatal error.

The code counts a value that is empty or a string on those pages.

Common causes

Code written for PHP 7: The plugin or theme was never updated for PHP 8.
Empty option or meta value: A value that should be an array is empty or a string.
Unmaintained plugin or theme: No release works with the PHP version the host now runs.

References

  1. count() (PHP.net)
  2. Backward incompatible changes in PHP 8.0 (PHP.net)

Rather not fix it yourself? Let WP119 handle it automatically.

White screens and fatal errors (plugin conflicts, PHP version incompatibility) are handled automatically: on a copy of your site in the recovery station, the system turns on debug mode, finds the plugin or theme causing the error and deactivates it (not deleted); a white screen caused by exhausted memory is fixed by raising the memory limit. After the fix, the home page and inner pages are re-verified, and only then is the result written back to your host (in WP admin mode, a recovered package is delivered instead). Fixes are made on a copy of your site in the recovery station and written back only after re-verification passes. In your site’s database, the protected tables (members, comments, orders and form submissions) are copied as structure only. In SSH and FTP mode, the system creates a pre-recovery backup on your host before writing back and restores from it if verification after write-back fails. If the recovery cannot be completed, the recovery fee is refunded in full.

  1. Initial assessment: Site URL entry
  2. Copy to the recovery station: Work on a copy
  3. Diagnosis: Item-by-item checks
  4. Recovery and verification: Home and inner pages
  5. Write-back or delivery: Only after verification passes

Use WP119 when this error appeared after a PHP upgrade and the site shows a critical error.

Check my site →
Initial assessment →