Unable to communicate back with site to check for fatal errors, so the PHP change was reverted

Issue Summary

Error appears when trying to save code to child theme functions.php.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular? All Sites.

  • This is happening in any site within LocalWP and I have tried to delete the site and recreate but still receive the error.


When adding the following code:

/** Add new widget called Header */
function twentysixteen_child_widgets_init() {
  register_sidebar( array(
    'name' => 'Header',
    'id' => 'header',
    'description'   => __( 'Add widgets here to appear in the Header Area.', 'twentysixteen' ),
    'before_widget' => '<div id="Header-Banner" class="widget %2$s">',
    'after_widget' => '</div>', 
    'before_title' => '<h2 class="widget-title">', 
    'after_title' => '</h2>', ) );
add_action( 'widgets_init', 'twentysixteen_child_widgets_init' );

…into the functions.php file of a child theme based on Twenty Sixteen WP theme and clicking Update, I receive an 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 do not receive an error when using this code in WAMP.

System Details

  • Which version of Local is being used? V5.10.3+5332

  • What Operating System (OS) and OS version is being used? Windows 10 Home v1909

It sounds like you’re trying to add code to the child theme from within the WordPress admin.

Since the site is on your local machine, it’s probably easier to edit the theme files directly.

Can you try opening the file directly and adding the code within your editor of choice? To do this, right click on the site and select “Reveal in File Explorer.”

From there, you can navigate to the wp-content/themes/child-theme folder and open the functions.php file using your editor of choice.

Yes I can do that but I’m trying to teach this as part of a WordPress course and showing how to edit a child theme etc. It works no problems when I edit them directly via File Explorer but wondering why this doesn’t work via WP interface on Local

Can you go into more detail about how you are guiding students to create the child theme?

One thing that I notice is that for newly created sites within Local, the twentysixteen theme isn’t installed. When I tried to replicate, I was able to add the code you mentioned without any errors:

That error you mention: Unable to communicate back with site to check for fatal errors does make me think of some sort of general networking issue. Do you have any antivirus enabled, or in some other “fancy things” with the local network. I’m thinking of something like a work computer that has security settings in place, or a firewall rule.

Hi Ben,
Thanks for the reply and the effort you’ve gone to trying to replicate.
The site is actually an imported site which I created for students to work on. It has the Twenty Sixteen parent theme installed and I have students create a child theme using a plugin. I have tried adding the code to the website when it is still using the parent theme, before creating and activating the child, but again I get the same error.

I’m on a standalone computer, not on a company network. It was working earlier in the year and for the years prior that i’ve used this as my training demo site but last 4-6 weeks has stopped working. It is also happening on all student computers so it’s either localwp or site specific. I know it’s not the code because I’ve tested the code on my live websites and it works, and the functionality works if I edit functions.php locally rather than via the Dashboard interface but it defeats the purpose as I’m teaching WordPress specifically.

P.S. I’ve also:
Tried deactivating all plugins - still couldn’t add code.
Tried rolling back to previous Twenty Sixteen theme versions (v2.3 and v2.2) version - still couldn’t add code.
Tried switching to Twenty Twenty theme - still couldn’t add code.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.