The WordPress theme and plugin editor reverts a PHP edit and cannot reach the site
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.Short answer
When you save a PHP file in an active theme or plugin, WordPress makes a request from the server to its own site to check that the page still loads, and undoes your change if it cannot. The error means that request failed. Test it from the server: wrong site URLs, a blocked or non-WordPress response, or an open PHP session are the causes.
Fix it fast
1Find out which cause you have
Make the same kind of request that Site Health makes, from the server itself. It posts to wp-cron.php on your site and expects HTTP 200. The result tells you whether the request fails before it gets an answer, or gets an answer that is not WordPress.
curl -sS -o /dev/null -w "%{http_code}\n" -X POST https://example.com/wp-cron.php2Match what you see, then jump to its fix
- 1
curl to your public address works from your laptop, but the server cannot open the address saved in WordPressThe site URLs in WordPress point at the wrong addressFix - 2
The first-step command prints 000 or a curl error, or a status other than 200 such as 401, 403 or 503The server's request to itself fails or gets a page that is not WordPressFix - 3
Site Health also shows An active PHP session was detectedA plugin or theme keeps a PHP session openFix - 4
The first-step request keeps failing for reasons you do not control, such as a managed host that blocks itThe loopback cannot be repaired on this host, so edit by SFTP and lock the editorFix
- 1
What does the error look like?
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.Your site could not complete a loopback request (Tools > Site Health > Status)
Cause 1 of 4
The site URLs in WordPress point at the wrong address
1Check
WordPress builds the loopback address from its own settings: the Site Health test uses the site address with wp-cron.php, and the editor check falls back to the home address. If either holds an old domain, http instead of https, or a port that is closed, the server calls the wrong place. Compare both settings with the address in your browser.
# In the admin: Settings > General > WordPress Address (URL) and Site Address (URL)
curl -sS -o /dev/null -w "%{http_code}\n" -X POST https://old-domain.example/wp-cron.php2Fix
Correct the two addresses in Settings > General. If wp-config.php defines them, correct them there, because the constants override the values saved in the database.
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );3Verify
Run the first-step request again. It should print 200, and Site Health no longer reports the loopback failure.
curl -sS -o /dev/null -w "%{http_code}\n" -X POST https://example.com/wp-cron.phpConfirmed by developer.wordpress.org
Cause 2 of 4
The server's request to itself fails or gets a page that is not WordPress
1Check
The test counts a transport failure as critical and any status other than 200 as a problem. A transport failure means no answer came back, for example because the server cannot resolve or reach its own name or the certificate does not validate for that name. A 401 or 403 means something in front of WordPress answered, for example a login prompt or a block page. The editor check also looks for a marker in the page it fetches, so a redirect or challenge page makes it fail as well.
curl -sS -I https://example.com/wp-cron.php
curl -sS -i https://example.com/ | head -n 202Fix
Read the verbose curl output, then fix what it shows: make the server able to resolve and reach its own address, and let requests from the server itself through any firewall, password gate or maintenance page. If the block sits on the host's side, ask the host. Then retest.
curl -v -X POST https://example.com/wp-cron.php3Verify
The first-step request prints 200.
curl -sS -o /dev/null -w "%{http_code}\n" -X POST https://example.com/wp-cron.phpConfirmed by developer.wordpress.org
Cause 3 of 4
A plugin or theme keeps a PHP session open
1Check
Site Health documents that a session created by session_start() interferes with REST API and loopback requests, and that the session should be closed with session_write_close() before any HTTP request. A plugin that starts a session on every page can cause that.
grep -rn "session_start" wp-content/plugins wp-content/themes2Fix
Update or replace the plugin that opens the session, or close the session as soon as it has been read.
session_start();
$cart = $_SESSION['cart'] ?? [];
session_write_close();3Verify
Reload Tools > Site Health and confirm the session warning and the loopback failure are gone.
# Tools > Site Health > StatusConfirmed by wordpress.org
Cause 4 of 4
The loopback cannot be repaired on this host, so edit by SFTP and lock the editor
1Check
The error message itself names the way out: upload the PHP change some other way, such as SFTP. The admin editor is also the riskier place to change live PHP, because a mistake runs on the live site.
grep -n "DISALLOW_FILE_EDIT" wp-config.php2Fix
Edit the file locally or over SFTP, and switch off the editor in the admin so nobody hits this error again.
define( 'DISALLOW_FILE_EDIT', true );3Verify
The theme and plugin file editors are no longer offered in the admin.
grep -n "DISALLOW_FILE_EDIT" wp-config.phpConfirmed by developer.wordpress.org
How do I stop it coming back?
- Change PHP in a local copy or a staging site, and deploy it over SFTP or Git, instead of editing live files in the admin.
- Set DISALLOW_FILE_EDIT in wp-config.php on every production site.
- Open Tools > Site Health after any change to hosting, firewall, domain or HTTPS settings, and fix a loopback warning at once.
- Keep the WordPress Address and Site Address equal to the address that visitors use.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
wp-admin loads a completely blank page in WordPress
Allowed memory size of xxxxxx bytes exhausted
A blank wp-admin is a PHP or database error that is hidden.
4 causes, each with a fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
Apache returns 403 when a URL contains %3F
a request like /page%3Fname=test is refused while /page?name=test works
Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.
2 causes, each with a fixBack end
Apache returns 500 with Premature end of script headers
500 Internal Server Error
Apache ran your script, but the script printed no valid HTTP header before its output.
3 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fix