- What Unsupported Operand Types Means in WordPress
- Which Values Trigger the Unsupported Operand Types Error in PHP 8
- Test a Value Against the Unsupported Operand Types Rule
- Why the Error Hits Some Posts and Not Others
- Find the Plugin Behind the Unsupported Operand Types Error
- Fix the Unsupported Operand Types Error Without Hiding Bad Data
- What Visitors, Admins and Your Inbox See
- Frequently Asked Questions: Unsupported Operand Types
- What does the unsupported operand types error mean in WordPress in 2026?
- How do I fix unsupported operand types in WordPress on AHosting without downgrading PHP?
- Why does unsupported operand types appear after upgrading to PHP 8 in 2026?
- Can I switch PHP versions per site on AHosting to get past unsupported operand types?
- Is casting with (float) vs an is_numeric check safer for unsupported operand types errors?
- Does a PHP 8.1 vs PHP 8.5 site throw unsupported operand types differently in 2026?
- Why do I get unsupported operand types on some pages but not others?
- Will WordPress send a recovery mode email when unsupported operand types breaks a public page?
- How can AHosting customers find the plugin behind a fatal TypeError in 2026?
- Can a try catch block stop the unsupported operand types fatal error in a plugin?
Unsupported operand types means PHP 8 refused to do math on text that is not a number. Empty strings, plain words and values such as $10 throw the fatal error, while null and false pass and text that starts with a digit only warns. Read the log line to find the file, guard the value with is_numeric(), and avoid a blind cast, because a cast turns the crash into a silent zero.
What Unsupported Operand Types Means in WordPress
The line Fatal error: Uncaught TypeError: Unsupported operand types: string + int means PHP 8 tried to do arithmetic on a value that is not a number and refused. Unsupported operand types is the engine’s wording: the two names after the colon are the types of the left and right operands, in that order, so “string + int” says the left side was text and the right side was a whole number.
PHP 7 only warned and treated the text as 0. The PHP manual now says that if a string used in arithmetic is not numeric, PHP throws a TypeError, and it notes that before 8.0 the same code raised a warning and returned 0. The change came from the Saner numeric strings RFC, which is marked as implemented in PHP 8.0, and its author discussed it with a host on the PHP Internals News podcast.
WordPress did not cause this. Core only caught the fatal and drew the critical error page, so the fix lives in the plugin, theme or snippet doing the math. A neighboring PHP 8 message, Undefined array key, is only a warning, and our Undefined array key guide covers it.
Which Values Trigger the Unsupported Operand Types Error in PHP 8
We ran one operation against 16 values on PHP 8.5.10 and recorded what each did. The pattern is simple: a string with no leading number throws, a string with a leading number warns, and everything numeric passes.
| Value | Result with + 2 (PHP 8.5.10) | Why |
|---|---|---|
"abc" | TypeError: string + int | No number at all |
"" (empty string) | TypeError: string + int | Empty is not numeric |
" " (one space) | TypeError: string + int | Whitespace only |
"$10" | TypeError: string + int | A currency symbol comes first |
"5", " 5", "5 " | Result is 7 | Whitespace on either side is allowed |
"1e3" | Result is 1002.0 | Exponent notation is numeric |
"5 apples" | Warning, then 7 | Leading number is used |
"0x1A" | Warning, then 2 | Only the leading 0 counts |
"1,5" | Warning, then 3 | The comma ends the number |
null, false | Result is 2 | Both count as 0 |
[] (array) | TypeError: array + int | Arrays are not valid operands |
Subtraction gave the same pattern for every value, and multiplication and modulo matched on the text cases we ran. Concatenation does not throw: "abc" . 2 simply gives abc2. We ran this on one Mac with PHP 8.5.10, not on an AHosting server, and we did not run PHP 8.0 through 8.4 ourselves, although the manual dates the TypeError to 8.0.0.
Test a Value Against the Unsupported Operand Types Rule
Use the checker below to try your own value. It applies the rules from Table 1 to common cases and does not model every exotic format, such as octal or binary strings.
PHP 8 Operand Checker
Type a value, pick the type and the operator, and see what PHP 8 does when the other side is an integer.
Why the Error Hits Some Posts and Not Others
Most WordPress values arrive as strings. The get_post_meta documentation says numbers are returned as strings, a stored false comes back as an empty string, and a key that does not exist gives an empty string when $single is true. Core confirms it: get_metadata_default() in meta.php sets $value = '' for the single case.
That explains the classic symptom. We wrote a shortcode that multiplies a saved price by 1.2 and placed it on three posts. The post with a saved price of 10 returned HTTP 200 and a total of 12. The post that never saved a price returned HTTP 500, and so did a post whose price was saved as $10. Same code, three outcomes, depending only on the stored text.
Field plugins widen the gap, because each field type returns different forms of data, including strings, integers and arrays. An option behaves differently: get_option() returns false for a missing option, and false + 1 is fine, but get_option('x', '') hands back an empty string and the same math fails.
Find the Plugin Behind the Unsupported Operand Types Error
The visitor sees only “There has been a critical error on this website.” The detail is in the PHP error log, and the steps below get you to the file in a few minutes.
- Add
define( 'WP_DEBUG', true );,define( 'WP_DEBUG_LOG', true );anddefine( 'WP_DEBUG_DISPLAY', false );to wp-config.php above the line that says to stop editing. - Reload the failing page once, then open
wp-content/debug.log. In our lab no log file existed with WP_DEBUG off, so the log only appears after step 1. - Read the first line. Ours was
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * float in .../wp-content/mu-plugins/lab.php:3. - Take the folder after
wp-content/plugins/orwp-content/themes/as the culprit, and the number after the colon as the line. - Look at the stack trace below it. It names the WordPress function that called the code, such as
do_shortcode, which tells you whether a shortcode, widget or template triggered it.
Remove the three constants when you are done. Your host’s own PHP error log may also hold the line, but we did not measure that on an AHosting server. If the fatal appears the moment you activate something, our plugin activation fatal error guide covers that case, and a Deprecated line in the same log is a different notice that our dynamic property guide explains.
Fix the Unsupported Operand Types Error Without Hiding Bad Data
Every fix either repairs the value or hides it. The table compares the common options, using the two bad values from our lab, an empty price and $10.
| Fix | Effect on an empty value and $10 | Verdict |
|---|---|---|
Cast with (float) | Both become 0 and the page loads | Hides bad data |
is_numeric() guard | You choose: skip, default or message | Best for your own code |
| Fill the blank setting | Removes the trigger on that post | Quick, per post |
| Update the plugin or theme | Vendor adds the guard | Do this first |
try and catch TypeError | Page survives, cause stays | Safety net only |
| Roll PHP back to 7.4 | Warning and 0 instead of a fatal | Short bridge |
If the code is yours
Check before you calculate: is_numeric( $p ) ? $p * 1.2 : null. Avoid the shortcut cast. In our lab (float) "$10" returned 0 and (int) "1,500" returned 1, so a price page loaded with a wrong number and no error at all, which is worse than a crash. PHP keeps explicit casts unchanged on purpose, and the internals-list thread on the RFC discusses preserving results such as (int) "2px", which is exactly why a cast silences the error.
If it is a plugin or theme
Update it first, then open its changelog and support forum with the log line in hand. Fill any blank numeric setting the stack trace points to, such as a columns or quantity field. Do not edit the plugin files, because an update overwrites them, and put your own patch in a child theme or a small mu-plugin.
When a PHP rollback is reasonable
In cPanel, MultiPHP Manager sets the PHP version per site, and a rollback gets a broken store selling again while you wait for a patch. PHP 7.4 no longer receives security fixes, so treat it as a bridge, and see our best PHP version for WordPress guide for the target. If you would rather not manage versions and logs yourself, our WordPress hosting plans are built around that workflow.
What Visitors, Admins and Your Inbox See
With display_errors off, our visitor request returned HTTP 500 and a 2,704-byte page with only the generic critical error message. With display_errors on, the page also printed the full fatal message, the stack trace and the server paths to every visitor, so keep display off in production and read the log instead.
The surprise is the email. Core’s recovery mode handler returns a non_protected_endpoint error and sends nothing when the fatal happens on a public page. By default only wp-login.php, admin screens and protected AJAX actions count as protected endpoints, so a broken front-end page can stay broken until a visitor tells you. Check the log after every PHP upgrade, and if you run your own stack on a VPS, the same line sits in your PHP and web server logs. On shared plans, our web hosting accounts use the cPanel tools described above.
Frequently Asked Questions: Unsupported Operand Types
What does the unsupported operand types error mean in WordPress in 2026?
Specifically, it means PHP 8 tried to do arithmetic on a value that is not a number and stopped with a fatal TypeError. The two types in the message are the left and right operands, so string + int means text on the left and a whole number on the right.
How do I fix unsupported operand types in WordPress on AHosting without downgrading PHP?
Specifically, read the PHP error log for the file path, then update or patch that plugin or theme. In your own code, check the value with is_numeric before the math and decide on purpose what a missing value should do instead of casting it to zero.
Why does unsupported operand types appear after upgrading to PHP 8 in 2026?
Indeed, the check is new in PHP 8.0. Before 8.0 the same line raised a warning and used 0, and the PHP manual says a non-numeric string now throws a TypeError, so old plugin code that never checked its input starts failing.
Can I switch PHP versions per site on AHosting to get past unsupported operand types?
Specifically, cPanel MultiPHP Manager lets you pick a PHP version for each site. A rollback to 7.4 only buys time, because that branch no longer receives security fixes, so use it as a short bridge while the plugin gets patched.
Is casting with (float) vs an is_numeric check safer for unsupported operand types errors?
In practice, is_numeric is safer. In our test a (float) cast turned both an empty value and the text $10 into 0, so the page loaded with a wrong total and no error, while an is_numeric check lets you skip the math or show a message.
Does a PHP 8.1 vs PHP 8.5 site throw unsupported operand types differently in 2026?
As a result of the PHP 8.0 change, both throw it. The manual dates the TypeError to 8.0.0 and we measured only PHP 8.5.10, so we did not run 8.1 through 8.4 ourselves, but nothing in the manual suggests a difference.
Why do I get unsupported operand types on some pages but not others?
In particular, the value comes from post meta or an option, and a post that never saved it returns an empty string. In our lab the same shortcode returned a total on a post with a saved price and a fatal on posts with no price or with $10.
Will WordPress send a recovery mode email when unsupported operand types breaks a public page?
In fact, no. WordPress core only sends the recovery email when the fatal happens on a protected endpoint such as wp-admin or wp-login.php, so a fatal on a public page gives visitors an error and gives you nothing unless you read the log.
How can AHosting customers find the plugin behind a fatal TypeError in 2026?
Typically, turn on WP_DEBUG_LOG, reload the failing page, and open the log in cPanel File Manager. The first path under wp-content/plugins or wp-content/themes in the line names the culprit, and the lines below it show which WordPress function called it.
Can a try catch block stop the unsupported operand types fatal error in a plugin?
In practice, it can keep the page alive, because TypeError is catchable. It also hides the cause, so use it as a safety net around third-party code you cannot edit and still fix the value that triggered it.





