[FIX] Unable to Communicate Back with Site: WordPress Error

Yesterday, I got this error while editing a plugin in the WordPress 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.

Here’s a screenshot of what the error looked like:

WordPress Unable to Communicate Back with Site Error
WordPress Unable to Communicate Back with Site Error

You can also encounter this error while saving changes to your theme files. Here’s how to fix the error, work around it, what NOT to do, and how to be safe while editing files.

“Unable to Communicate Back with Site” – Blame Cloudflare

Cloudflare is the most common reason for this error. You’ve probably added a firewall rule that prevents WordPress from communicating with the server. In my case, a firewall rule prohibited direct access to PHP files without a challenge. Here’s a screenshot of my rule:

Cloudflare Rule Causing the Problem
Cloudflare Rule Causing the Problem

This rule presents a JS challenge to anyone attempting to access PHP files on my server directly. While my browser passes the test, I suspect WordPress is making a call that Cloudflare blocks. Temporarily disabling this rule fixes the problem, and you get a “File edited successfully” message:

File Edited Successfully
File Edited Successfully

Disable your firewall rules one by one to see which one is causing the problem.

Use Cloudflare’s Development Mode to Debug the Error

If you have a complex Cloudflare setup, the quick way to check whether or not the problem lies with Cloudflare is to temporarily disable Cloudflare by switching on “Development Mode”. Development mode disables all Cloudflare caches, firewall rules, and workers. Your traffic still passes through Cloudflare, but Cloudflare doesn’t modify your traffic. To enter development mode, click “Overview” in the Cloudflare dashboard and turn it on as shown here:

Cloudflare Development Mode to Debug the WordPress Error
Cloudflare Development Mode to Debug the WordPress Error

If Cloudflare is the reason your site isn’t able to communicate back with the server to check for fatal errors, then everything should work fine after you switch to development mode. Once you’ve identified Cloudflare as the problem, you can determine which rule is the culprit.

Workaround #1: Use Your Web Host File Editor Instead

I’m not a big fan of using the WordPress editor to modify plugin themes and files. In recent years, WordPress has been more stable and reverts changes to the file if there’s an error, but it still carries risk. If something goes wrong and your WordPress site crashes, there’s no way to revert the changes.

Instead, I suggest you log in to your web host and use their file manager directly to make changes to WordPress themes and plugins. Here’s a screenshot of cPanel’s file manager that you can use:

Use the cPanel File Manager to Prevent WordPress Errors
Use the cPanel File Manager to Prevent WordPress Errors

This way, in the case of a fatal error, you can undo your changes immediately.

Workaround #2: Use SFTP to Manage your WordPress Files and Folders

An excellent alternative to cPanel is SFTP. It’s superior to standard FTP because your connection is encrypted, and your passwords don’t travel in plaintext. Here’s how to use the cPanel SFTP tool to create secure connections to manage your WordPress files and folders.

Warning: Don’t Modify Core WordPress Files

While researching solutions to this problem, I’ve seen some people suggesting that you modify the core WordPress file:

wp-admin/includes/file.php

They suggest changing this line:

if ( $is_active && 'php' === $extension ) {

To this line:

if ( $is_active && 'php' === $extension && false) {

This fixes the “Unable to communicate back with site to check for fatal errors” message, but I strongly advise you against modifying WordPress core files. For one, WordPress will overwrite your changes whenever it releases a new version, and you’ll be back to the starting point. Second, you might not fully understand what you’re doing. The above change, for example, returns “false” all the time and removes an essential security feature.

Only edit theme and plugin files in the “wp-content” directory. Never modify files in “wp-admin” or “wp-includes”.

A combination of the above solutions should solve the “Unable to communicate back with site to check for fatal errors” message while editing WordPress theme and plugin files. I hope you found it helpful!

About Bhagwad Park

I've been writing about web hosting and WordPress tutorials since 2008. I also create tutorials on Linux server administration, and have a ton of experience with web hosting products. Contact me via e-mail!

Speak Your Mind

*

WP-Tweaks