I am unable to edit main theme (php) files using the build in WordPress editor after upgrading to version 4.9. I get the following error:
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.
I have cleared my browser cache, cleared my website cache, de-activated all plugins and reinstalled main theme.
Furthermore; I am able to edit php files in other themes without issues. I have also checked my permissions and ownership of all files. Everything seems perfect.
The page I need help with: [log in to see the link]
Hello, I want to add my little bit on that issue.
Actually my problem was the loopback, and it was caused by this plugin:
Social Login WordPress Plugin – AccessPress Social Login Lite
After disabling it, the problem went away and the Health Check plugin reported no loopack problem.
My issue actually appeared some days before the update, and the failed loopback was torturing me. The new editor timed out when trying to save, after exactly 30 seconds (php timeout). While it was trying to save, the whole website was hanging.
The loopback issue also caused some of my crons to stop working entirely. I don’t know how to get them back to functioning again though. It was also conflicting with Jetpack crons, causing the whole site to hang. I am on a dedicated server btw.
- This reply was modified 4 years, 8 months ago by Dpsachou.
If it’s an emergency @t10cricket update your header.php offline and upload via ftp.
To find out where exactly the problem lies I would suggest following these steps:
1. Download the free Health Check plugin – https://wordpress.org/plugins/health-check/
2. Make a backup of your website (I recommend Updraftplus – https://wordpress.org/plugins/updraftplus/)
3. Run a Health Check using the Health Check plugin. Do any fields have 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.”
4. Download the Twenty Seventeen theme and activate it. Run the Health Check again. Do you see a loopback or any other failed response? If so, disable all plugins (except Health Check) and run the Health Check. You may see “The loopback request to your site completed successfully.” This probably means one of your plugins is the problem: re-activate them one by one, running Health Check each time, or in small groups if you have lots of plugins, to isolate the problem.
5. If you still see the loopback request error in Health Check post some of your server debug information here (see mine below) including your webhost, which hosting package, server, php and mysql version.
@clorith With all plugins disabled and the Twenty Seventeen theme activated I still get the following error on trying to edit a theme or plugin php file: “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.” Also getting a failed loopback request in Health Check with all plugins deactivated. Is there anything I can ask my host to check? Thanks in advance for any suggestions. 🙂
Just so you don’t have to search for it again in this thread, here are my details:
Webhost: Blacknight (Maximus shared hosting package)
Exact Error: 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.
When does it occur?: A few seconds after clicking the Update button on editing an active Theme php file or active plugin php files (css or txt files are not affected) in the WP theme or plugin editor.
Error still occurs with plugins de-activated and 2017 theme activated. Re-activated plugins and ran Health Check with the following results:
Server architecture: Linux 2.6.32-673.26.1.lve1.4.30.el6.x86_64 x86_64
PHP Version: 7.0.25 (Supports 64bit values)
PHP SAPI: cgi-fcgi
PHP max input variables: 2048
PHP time limit: 120
PHP memory limit: 256M
Upload max filesize: 32M
PHP post max size: 32M
cURL Version: 7.54.0 OpenSSL/1.0.2k
SUHOSIN installed: No
Is the Imagick library available: No
Server version: 5.5.57
Client version: 5.6.37
Your PHP install supports JSON.
Your MySQL version supports utf8mb4
WordPress.org is reachable from your server.
You are using HTTPS to access this website.
Your WordPress install can communicate securely with other services.
No version control systems were detected.
Your installation of WordPress doesn’t require FTP credentials to perform updates.
All of your WordPress files are writable.
– A scheduled event (nxs_querypost_event) has failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.
x The WP_AUTO_UPDATE_CORE constant is defined and enabled. [I have this set intentionally].
x WordPress security and maintenance releases are blocked by define( ‘WP_AUTO_UPDATE_CORE’, false );. [I have this set intentionally so I can review updates on a test site first]
x Unable to perform a loopback request to your site, this may prevent WP_Cron from working, along with theme and plugin editors.
Hi! I have an error “Unable to perform a loopback request to your site…” 401.
The plugin Health Check trying to GET /wp-admin/ dir and get 401 error because I have blocked all external queries to this dir instead admin-ajax.php file. It’s for security reasons.
So how I can fix it? Why loopback requires dir /wp-admin/ ? That is not good.
@gopros That’s expected to fail in your case, we are requiring the loopback to ensure you don’t accidentally whitescreen your self when making edits.
It should be noted that the built-in editor isn’t meant as a full on replacement from proper external edits, it’s a rough tool made for quick edits by users that are inexperienced with other tools, if you have the experience to lock down your admin URLs, you should also be able to use an external editing tool.
I am also getting this issue:
‘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. ’
We are not simply editing the code in a Live Production environment though. We make all our changes in a Pre Production environment, which is locked down. We do not have SFTP access, and make changes in the functions editor when they are needed.
It is all tested in a Development environment first, so we know the code works. We do not need the sandbox testing.
The problem is that the Pre Production environment is not letting any web traffic into the site.
Are there any IP addresses for your sandbox servers we can add to the white list to allow this service to get through?
As a test our, IT team let traffic through on port 80 and 443 but it still did not work.
I think in the next version of WordPress it would be better to have this sandbox feature as an option. Please let users switch it off if they want too. You can always have a message saying you can break your site if you do so. Much like you have on the CSS editor.
For more information, we are hosting all of our sites via Amazon Web Services.
@pholli We do not host any services for this, the sanbox mode is merely the best representation of what we do when you try to make edits in this file.
A loopback request is generated, meaning your own server needs to be able to access your admin area. In your case, using AWS, your sysop should be able to troubleshoot this much more accurately for you (please do report any findings that may be of any help back to us though).
@clorith Thanks for the swift reply.
I passed the message on to the IT team and they have tried a few things, still with no luck.
Could you please clarify the statement:
‘your own server needs to be able to access your admin area’
If we had more of an idea about this we might be able to solve it.
@clorith Our IT team has had success. We can now add code to the functions.php file. It was down to certain things being blocked on the web application firewall.
Here is an explanation from the team, this may be specific to AWS and our setup of environments, but it may help others in the same situation:
‘We were blocking the everything except trusted IPs on the WAF to admin pages and wp-login and only allowing these trusted IPs onto the network in the VPC therefore not allowing loopback. We allowed the public EIP that the NAT Gateway uses to access the internet into both the public subnets (Load-Balancer) via Security Group rule and to the Whitelist that bypasses all WAF rules. Loopback now works and so does the editor’
Thanks for the help.
Download a copy of Notepad++ (it’s free).
Watch this video showing how to use Notepad++ to connect to your site and edit your theme or plugin files:
You may have to re-start Notepad++ a few times. Just be patient and follow the prompts. Your ftp details should be in the original email from your host.
MAKE SURE you have a backup of your site before you make any changes.
Despite disabling all plugins, switching to TwentySeventeen theme and checking htaccess, I’m still experiencing the issue on Wamp localhost and Apache but using the Notepad++ method for now.
Hope it works for you.
@debresser Would you be able to run the Health Check plugin (it will take a while to load when the save feature is failing I’m sorry to say, but it would be really useful if you could load it up, go to the “Debug” tab and copy the content there (there’s a little button at the top that gives you a handy field to copy and paste from)
### WordPress ###
Permalink structure: /%postname%/
Is this site using HTTPS?: No
Can anyone register on this site?: Yes
Default comment status: closed
Is this a multisite?: No
User Count: 1
Communication with WordPress.org: WordPress.org is reachable
Create loopback requests: Unable to perform a loopback request to your site, this may prevent WP_Cron from working, along with theme and plugin editors.
### Active theme ###
Name: Twenty Fourteen
Author: the WordPress team
Author website: https://wordpress.org/
Parent theme: Not a child theme
Supported theme features: editor-style, automatic-feed-links, post-thumbnails, menus, html5, post-formats, custom-background, featured-content, customize-selective-refresh-widgets, custom-header, widgets
### Other themes (3) ###
Twenty Fifteen (twentyfifteen): version 1.9 by the WordPress team
Twenty Thirteen (twentythirteen): version 2.3 by the WordPress team
Twenty Twelve (twentytwelve): version 2.4 by the WordPress team
### Active Plugins (6) ###
Akismet Anti-Spam: version 4.0.1 by Automattic
Exclude Pages from Navigation: version 1.92 by Simon Wheatley
Health Check: version 0.5.1 by The WordPress.org community
Jetpack by WordPress.com: version 5.5 by Automattic
WP-RTL: version 1.0 by Fahad Alduraibi
WP-SpamShield: version 1.9.21 by Red Sand Media Group
### Server ###
Server architecture: Linux 3.12.74-214.ELK6.x86_64 x86_64
PHP Version: 5.4.45 (Supports 64bit values)
PHP SAPI: cgi-fcgi
PHP max input variables: 1000
PHP time limit: 30
PHP memory limit: 256M
Upload max filesize: 64M
PHP post max size: 64M
cURL Version: 7.19.7 NSS/3.27.1
SUHOSIN installed: No
Is the Imagick library available: Yes
### Database ###
Server version: 5.5.51-38.2
Client version: 5.5.51
Database prefix: wp_
### WordPress constants ###
### Filesystem permissions ###
The main WordPress directory: Writable
The wp-content directory: Writable
The uploads directory: Writable
The plugins directory: Writable
The themes directory: Writable
We investigated in our case why this would happen and found out that as the ShortPixel plugin main class was instantiated on the wp_ajax request of the editor updating the edited file, it would block at session_start() (ShortPixel uses sessions to store some data, this is scheduled to be changed in a future version, just didn’t find time to do it yet)
This could be the cause also in other plugins. For ShortPixel will filter the wp_ajax requests for which the plugin instantiates and release a new version.
To followup on the above post from @shortpixel and also my earlier post, I uploaded via ManageWP the fixed plugin ShortPixel left on the dev site where they were exploring this issue, onto other sites using ShortPixel…
Now I’m discovering that their fixed plugin only fixes the issue on some of them… A site where it fixes it is the single one on the 12Wonder server, a goodly number of plugins active…
Sites where it both does and does not fix it are on the Radiant server… Where it does fix it on the Radiant server there are minimal plugins activated… Where it does not fix it are sites with a goodly number of active plugins, production sites I don’t want to be messing with…
- This reply was modified 4 years, 8 months ago by crzyhrse.
This finally solved it for me…
Even though I had deactivated all plugins, changed the theme to Twenty Seventeen and cleared browser cache I was still getting the following error when trying to edit theme or plugin php files: “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.”
I had to delete advanced-cache.php in the wp-content folder and in wp-config set:
Then I could edit the theme and plugin php files without the error.
So, then I re-set my wp-config to:
re-activated my plugins, including Hyper Cache Extended (which restored the advanced-cache.php file in the wp-content folder), and I can still edit my theme and plugin files without a problem.
Thanks @clorith for not asking us to open our own support threads. This thread now has different solutions to the same error in one location which, hopefully, will be a great help to others who experience the issue. 👍
- This reply was modified 4 years, 8 months ago by Pádraig Ó Beirn.
@debresser Did you make sure you disabled all plugins and test? I can reproduce the problem when running the WP-SpamShield plugin locally.
I must re-iterate for those still experiencing issues, as it makes it that much harder for us to troubleshoot, make sure ALL plugins are disabled, and see if the problem persists.
If the problem persists even when absolutely all plugins are disabled (make sure you don’t have any must-use plugins hanging around, those can also affect things), please visit the PHP information page of the Health Check plugin, this one is when we need very specific data, and look for the configuration option named
session.auto_start, it should have two values, are any of these set to
If the problems are still around, the Health Check plugin can be a bit slow, use
wp-admin/index.php?page=health-check&tab=phpinfoto get directly to the page without going through the slow first page load 🙂
- The topic ‘Can’t edit main theme php files after upgrading to 4.9’ is closed to new replies.