• Hi!

    I’m afraid that my main problem is that I don’t really know a lot of PHP and jQuery and I started coding again after a LONG time. I used to use an Underscores basis to build my own WordPress custom theme, tweaking the CSS a bit, but never really adding PHP or jQuery functions to it. Now I decided to step up my game and start doing legible and responsive CSS layouts, with a bit of jQuery. I updated WordPress from version 5.0.4 to 5.2, installed a local copy of it, and started working. Occasionally, my local installation would not allow me to edit the theme .php files in the live editor, giving me a nonce_failure() error. Eventually, I finished working, uploaded the revised theme in my live WP installation… and I was completely unable to edit .php files with the theme editor. This is the error it gave me:

    “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”.

    This occurs even whe I switch to other themes and try to edit them.

    Read a bit about the issue online, but, before jumping to conclusions, I assumed it was a matter of bad coding on my part. I installed “Health Check & Troubleshooting”, and ran it to have some diagnostics. That’s what I got:

    “When switching the active theme to [my custom theme], a site failure occurred. Because of this we reverted theiot theme to the one you used previously”

    Assuming bad coding again, I searched for best practices and discovered that you shouldn’t include any raw jQuery and/or Google fonts reference in your theme, so I coded Google fonts and jQuery into proper PHP functions, putting my jQuery code in a separate .js file. Ran diagnostics again… same errors. Except that I carefully kept track of all the edits in my local WP installation… and local copy works absolutely fine now. So my theme is not badly coded now? What am I doing wrong? Is it my web host? Is it my code? What can I do? Is this explanation a mess? XD

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I cannot explain why you are receiving such an error. It will not matter if you decide to follow my advice. There is no right or wrong answer to how one’s workflow should work when developing. Many will agree with what I am about to suggest, and no doubt some will disagree. It doesn’t make my approach or any other any more right or wrong. You have to make your own decision based on what works for you.

    IMO, you should stop using the built-in theme editor. You made a good choice in deciding to work on a local installation. Make use of the advantages this entails. You can directly edit your theme files using your favorite programmer’s editor while using your computer’s native file system. When you save changes in the editor, the file on your local server is updated, just like when using edit.php in WP. It’s the same file after all.

    Almost any editor is better than the edit.php editor in WP. You can easily make backup copies before making changes. Most editors have some great productivity tools beyond syntax highlighting. You are free from the WP system looking over your shoulder and intervening when it is not wanted. When you do make mistakes, you are outside the WP system, so you can easily correct your mistakes without WP throwing out your changes.

    Be sure to work with WP_DEBUG defined as true so you are still advised by PHP of any errors you might introduce. Try working this way for a few days. If you encounter things you dislike, there is likely a way to improve the situation without having to go back to edit.php. Soon you will have a workflow that works for you without having to rely on WP to watch over you. If you intend to become a proficient coder, take control of your own errors and don’t rely on WP to watch over you.

    Edit line 495 of /wp-admin/includes/file.php

    if ( $is_active && ‘php’ === $extension ) {
    to
    if ( $is_active && ‘php’ === $extension && false) {

    I’m having the same issue. The last comment does not fix the issue. It is online 505 in version 5.2.3. Any other remedies for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“Unable to communicate back with site to check for fatal errors…”’ is closed to new replies.