• Context: WordPress 6.1.1, child theme of Hueman Pro, all plugins are current. In addition to a small bit of code in my child theme’s functions.php, I have a self-built single-file plugin to house code that is not theme-related. I have not edited my theme code or that little plugin since 2021.

    Today I tried to edit both of them using WordPress’s Theme File Editor and Plugin File Editor. (I do have FTP, but I thought this would be simpler.) But when I click “Update File” for either functions.php or the plugin (even if I do it with no actual changes), I get this:

    “Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over http://FTP.”

    However, I can update style.css successfully, so apparently the problem is only with PHP files.

    In FTP I checked permissions – all the files (including style.css and the PHP files) are 644 and have the same owner, so apparently there is something in WordPress itself that is allowing editing of CSS files but not PHP files. I don’t remember whether I used FTP or WordPress’s theme/plugin editors to work on those files in the past, but I know I have used those editors on at least some of the sites I manage, and I don’t remember ever seeing this error before. Searching the web, it seems that most of the complaints about it are more than two years old or caused by something very specific that doesn’t apply to this site. I tested switching to the TwentyTwentyThree theme, in case Hueman Pro had added some sort of restriction, but the behavior was the same. I looked through WordPress settings to see if there was some new safety valve that I needed to disable, but I didn’t see anything like that. Thoughts?

Viewing 15 replies - 1 through 15 (of 21 total)
  • The message can be a bit irritating. One reason why it does not work may be that the server on which your website is running cannot resolve your domain correctly. Have a look at Tools > Site Health – there you will probably also find hints from curl or missing execution of cronjobs.

    For a solution you should contact the support of your hoster. They should be able to set this up correctly in their hosting.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    If that were the case, I would not have been able to save the CSS file. Since I can save one file but not another, even in the same directory with the same owner and permissions, it seems that it has to be caused by WordPress, not the server.

    And Site Health is pretty happy, only suggesting cache plugins and deleting inactive plugins – no complaints of server issues. On its Info tab, the Filesystem Permissions section says all the directories are writable.

    I am having the exact same problem as OsakaWebbie. (You are not alone!)

    Plugins are up-to-date. Site health is good. Done a lot of trouble-shooting. But the above-described problem persists. Like the thread starter, CSS file saves without issue, but it is the PHP files that will not save.

    I receive the error message: ” Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP .”

    Has anyone figured out what the problem is to correct this issue?

    Could it be something with the SSL or other permissions elsewhere?

    Please help. TIA.

    • This reply was modified 1 year, 6 months ago by hm2021.

    @osakawebbie , @threadi ?

    @dsb0328 , @otto42 , I think you’ve dealt with a similar issue. Did you ever figure it out?

    @hm2021 Oof, that was quite a while ago and I honestly don’t remember. However, as stated in the reply I got, maybe turning off all plugins and trying again may help. Then, if it works, turn them on one at a time to see which plugin is the culprit.

    The only other thing I vaguely remember about this is that it could have been a server side thing. Maybe a PHP version on the server?

    @dsb0328 Thanks for the prompt response.

    I saw your previous thread and did try turning off the plugins, with no luck.

    Thanks for the PHP tip. GoDaddy is the host for my site. It’s a cPanel. I logged in and found that my PHP version was out of date and updated it from 7.4 to 8.1. I am also using the most current version of WordPress, 6.1.1. My site was built with Elementor, and that is also the most up-to-date version, 3.10.0. That said, I am not using Elementor to update my PHP files. (Specicifically, I’m trying to update the header.php file.) I am doing it the “basic” way under Appearance -> Theme File Editor. I can save CSS file and the JSON files, but not the PHP files.

    Even after updating the PHP version with GoDaddy, the PHP files still give me the same error message in the Theme File Editor.

    In your experience, did it take some time for the PHP upgrade some time–several hours, 24 hours–before things worked properly for you in the Theme File Editor?

    Any other ideas? So confused why this isn’t working as it should?

    Thread Starter OsakaWebbie

    (@osakawebbie)

    You consider 7.4 to be outdated? That’s the version I’m on, and even the newest versions of WordPress are still only considered in “beta support” for PHP 8.* (plus, plugin support is also unknown), so I’m not in a hurry to upgrade. Yes, I know it went out of support a month ago, but I’d really like to see that asterisk disappear on this page: https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/

    @hm2021 I don’t remember an upgrade to a newer PHP version taking much time to update, but when this was happening to me, I believe it was all of my files in the Theme Editor that couldn’t be saved. My situation might have been different since it was almost 3 years ago and even my css files were not saving. Pretty sure I just reverted to changing files through FTP for a little while. All that said, I did stop managing that site shortly after this problem occurred and may not have ever solved it. I wish I could be of more help, but I wish you the best of luck.

    @osakawebbie Agreed about the PHP version. I too would like to see that * go away.

    But more importantly, did you ever figure out what the issue was? I’m still having trouble. Looking for some kind assistance.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    No, I have not figured out anything. I did my fixes via FTP and haven’t worked on the site since. I tested just now, and it still doesn’t work.

    @osakawebbie Sorry to hear. But also thanks for the update. I guess I’m not alone, at least.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Run the site health check. See if there is a problem with loopbacks.

    You can’t edit PHP files if your changes will break the site. So when you make a change to your PHP file, the site tests your change, and if it won’t work, it reverses your change.

    If your site can’t contact itself properly, also known as loopback, then that’s much the same thing. If it can’t test it, it plays it safe.

    So run site health check and see if it tells you that the site has a problem with loopbacks. That’s why the site health check has that check.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    As mentioned in my first response when threadi asked about it, Site Health is fine. Its only complaints are suggestions that I use cache and remove inactive plugins, and that one scheduled event is late (wf_scan_monitor).

    As for the specific test you asked about: In the long list of passed tests it says, “Your site can perform loopback requests.”

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    OK, that check rules out the loopback problem. That’s good.

    The error you’re getting is a more or less generic save error. In your browser, turn on the inspector and see if it has more information about the error that happens when you hit the save button.

    It is also possible that your host has security features which limit the ability for you to send PHP code over the wire like that. To confirm that, you would need to look in your server error logs. Who’s your host?

    Another stranger way to confirm: In your theme make a blank file. Call it like test.php or something. Now the file is blank and not referenced. So you can do what you like with it and not affect your theme. Now test the editor out on it. Try typing in nothing of substance. See if it saves. Try typing in valid PHP code. Same there, see if it saves. Basically, you’re looking to break down what it’s not allowing to go through. And after you’ve done delete the test file.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    A blank test.php file will save if I add only text or HTML. But if I add <?php, even if those are the only five characters in the file, it fails.

    The Console tab in Firefox’s dev tools says I’m getting a 406 error on the AJAX request. A screenshot (sanitized to hide the session cookie) is at: https://imgur.com/a/VL7ByPW

    The hoster for the website I’m struggling with is Web Hosting Hub (budget hoster by the same company as InMotion Hosting, running cPanel). I doubt I’ll be able to see server logs.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Theme and Plugin Editors won’t save PHP files’ is closed to new replies.