PHP Editor Errors in WordPress 4.9+
WordPress 4.9 Tipton introduced error checking when saving PHP files in the wp-admin to help users avoid fatal errors. While this is a great feature intended to protect users, the loopback check this performs has experienced conflicts with some plugins. You may experience the following error when saving changes to PHP files in your WordPress Admin Dashboard editor:
Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.
About the Error
The issue lies with an open
session_start() function being called unconditionally. This means that a plugin or theme is trying to initiate PHP Sessions everywhere on the site, instead of strictly where it’s needed. WordPress does not use PHP Sessions so should a session should not be initiated on the editor pages.
Multisite’s are a special case to this rule. If a theme is “Network Activated” in a multisite, WordPress will apply the PHP editor rules to those active themes. They can edit themes that are not network activated.
To find out where the problem lies within the WordPress Admin Dashboard Editor you will need to do some troubleshooting:
- Make a checkpoint of your website
- Run a Health Check using the free Health Check plugin
- Look for any fields with a red “x”. You may see a message which reads:
- Unable to perform a loopback request to your site, this may prevent wp_cron from working, along with theme and plugin editors.
- Copy your site to Staging using the checkpoint you made in Step 1
- Download the Twenty Nineteen theme and activate it
- Run the Health Check plugin again. Do you see a loopback error or any other failed response?
- If no, then your theme may be the issue. Reach out to your theme developer for guidance.
- If yes, disable all plugins (except “Health Check”) and run the Health Check again. If you see “The loopback request to your site completed successfully.” This indicates one of your plugins is the problem. Re-activate them one by one, running a Health Check each time. If you have a lot of plugins you can re-activate them in small groups instead.
- If you still see the loopback request error in Health Check, review any external firewall settings and any security settings in your .htaccess file. You may want to test with a default .htaccess file as well.
There are a variety of plugins reported to cause this issue, including:
- Magic Fields
- WP Spamshield
- Social Login WordPress Plugin – AccessPress Social Login Lite
- Ninja Popups for WordPress
- Custom firewalls or security rules
- Some custom themes
- ShortPixel Optimizer
- WP Server Stats
NEXT STEP: Test the newest version of PHP with our PHP Test Driver