The short version
WordPress 7.1 and older WP Rocket releases can be a bad combination. On affected sites, a normal request can reach WP Rocket's Cloudflare compatibility code and stop on this error:
TypeError: substr(): Argument #1 ($string) must be of type string, int given
wp-content/plugins/wp-rocket/inc/ThirdParty/Plugins/CDN/Cloudflare.php:562 That is not a warning tucked away in a log while the site carries on. It is a fatal error. Depending on where it fires, visitors can see the WordPress critical error screen and you can lose access to wp-admin.
WP Rocket released the 3.23.2.2 fix on 20th August 2026. Its changelog now lists later releases, including 3.23.5.1 on 2nd October. The original fix version identifies this incident; use the latest stable package available from the vendor for an update today.
What causes the WP Rocket incompatibility
The crash sits in WP Rocket's Cloudflare integration code, but this is the slightly confusing bit: you do not need the separate Cloudflare plugin installed for it to happen. The original report reproduced the error without it.
In plain English, WP Rocket looks through a list of WordPress callbacks and checks the end of each callback
ID with PHP's substr() function. The code expects every ID to be text. Under the conditions
reported with WordPress 7.1, one of those IDs can arrive as an integer instead. PHP 8 refuses to treat that
integer as a string automatically, so it throws a TypeError and stops the request.
The actual code correction is tiny: cast the value to a string before passing it to substr().
The impact is not tiny. A single missing type cast can turn a routine core update into a dead site.
How the fault was identified and fixed
The original bug report was opened on 6th July 2026 and reproduced the crash with WordPress 7.1 alpha and PHP 8.3. The report included the error and a proposed correction. The fixed release followed on 20th August. Those dates describe the original incident; the update is available now.
Update WP Rocket before testing WordPress
If WP Rocket is older than 3.23.2.2, update it before testing a WordPress upgrade. The original error was reproduced without the separate Cloudflare plugin, so its absence does not rule out this fault. Keep WordPress security updates moving once the plugin issue is resolved.
You may see another site with the same versions update cleanly. That does not prove yours will. The fatal depends on the callbacks registered by the site's particular mix of plugins and theme. Two outwardly similar sites can behave differently.
Our advice is simple:
- Record the installed WordPress and WP Rocket versions and check the release notes.
- Take a fresh, restorable backup of files and the database.
- On a staging copy, install the latest stable WP Rocket release from your account.
- Update that staging copy to the latest available WordPress release.
- Check the front end, wp-admin, publishing, cache clearing, forms, checkout, and scheduled jobs.
- Only update production after those checks pass.
If you do not have a safe place to test, our guide explains how to create a WordPress staging site. Our safe plugin update checklist covers the same backup, test, verify routine for everyday updates.
Is Elementor affected too?
We have not found evidence of a separate Elementor fatal error caused by WordPress 7.1 in this incident. That distinction matters. An Elementor site running an affected WP Rocket version can still go down, but the fatal stack trace points to WP Rocket, not Elementor.
The
WP Rocket fix and regression test
describe the trigger as a plugin, theme, or custom code registering a Closure or invokable object on either
deleted_post or transition_post_status. They do not name Elementor. Elementor does
use post lifecycle hooks, but that fact alone is not enough to reproduce the crash. The specific callback
shape matters, and we have not found a reproducible report that ties Elementor to it.
So the honest answer is: Elementor is not confirmed as the cause, and we would not deactivate it on a guess.
If your Elementor site shows the exact Cloudflare.php and substr() error above,
update or disable WP Rocket first. If the stack trace names Elementor or Elementor Pro instead, treat that
as a different compatibility problem and investigate it separately.
Already updated and staring at a critical error?
Do not keep refreshing and hoping the cache sorts itself out. If the error contains
wp-rocket/inc/ThirdParty/Plugins/CDN/Cloudflare.php and substr(), disable WP Rocket
first so WordPress can load again.
- Open your hosting file manager, SFTP, or SSH and go to
wp-content/plugins. -
Rename the
wp-rocketdirectory towp-rocket-disabled. WordPress will no longer be able to load that copy of the plugin. - Reload the site and wp-admin. Take a backup before making the next change.
- Download the latest stable WP Rocket package from your legitimate account. Keep a private copy of the old folder, then replace the disabled installation with the clean vendor package. Ask your host to help if you are unsure which folder to replace; do not leave multiple plugin copies installed.
- Reactivate WP Rocket, clear its cache, and check both logged-in and logged-out pages.
If you are not comfortable working in the plugins directory, stop after the backup and ask your host or a developer to handle it. The longer walkthrough for regaining access is in deactivating a WordPress plugin without wp-admin. If the error is different, use the broader WordPress critical error guide instead of assuming WP Rocket is the cause.
Do not edit the WP Rocket file as the first fix
Yes, the public report shows a one-line change. No, that does not make editing a live premium plugin the best first move for most site owners. A typo can trade one fatal error for another, and the next plugin update can overwrite the manual edit without warning.
Recover access by disabling the broken plugin copy, then install the vendor's fixed release. A manual patch can be a short emergency bridge for a developer who understands the code and has a backup. It should not become the permanent version running your site.
What this says about WordPress update day
The lesson is not “never update WordPress.” Staying on an old core version forever creates its own security and compatibility problems. The lesson is that release day is a poor time to discover whether a commercial plugin tested the same combination you run in production.
A backup gives you a way back. Staging shows you the break before customers do. Monitoring tells you if the live site stops answering after the change. Those are separate jobs, and you want all three. BugShield's managed backups, uptime monitoring, and managed WordPress updates are built around that reality.
The original compatibility fault is fixed. Bring WP Rocket up to date, test WordPress updates and verify the public site, dashboard and important forms after deployment. If the same error continues with a current plugin, preserve the error details and ask the vendor to investigate rather than repeatedly delaying WordPress updates.
Quick answers about WP Rocket and WordPress 7.1
Which WP Rocket version should I use with WordPress 7.1?
WP Rocket 3.23.2.2 was the first release fixing this error. Install the latest stable vendor release, then test it with current WordPress updates on a staging copy before changing the live site.
Does this problem only affect sites using the Cloudflare plugin?
No. The fatal error sits in WP Rocket's Cloudflare compatibility code, but it was reproduced without the separate Cloudflare plugin installed.
Should I update WordPress or WP Rocket first?
Update WP Rocket first on staging, then test the latest available WordPress release. Check public pages, wp-admin, forms, checkout and scheduled tasks before applying the tested combination to the live site.
What should I do if the update has already caused a critical error?
If the error names WP Rocket's Cloudflare.php file and substr(), disable WP Rocket through your hosting file manager, SFTP or SSH. Then install a current copy from your WP Rocket account and test the site before reactivating it.
Is Elementor responsible for this compatibility issue?
There is no confirmed separate Elementor fault in this incident. Check the error details first. If they point to WP Rocket's Cloudflare.php file, deal with WP Rocket rather than disabling Elementor on a guess.