If I understand you correctly, you have two concerns:
For you, the Theme File Editor is only visible under “Appearance” for classic themes, not for block themes. With block themes, it’s generally hidden because it’s no longer necessary to edit theme files directly with this type of theme.
For classic themes, it’s normally visible unless it’s disabled by the DISALLOW_FILE_EDIT constant in wp-config.php or by a security plugin you’ve installed.
If, while editing, you receive the message
Unable to communicate back with the site to check for fatal errors, so the PHP change was reverted.
this indicates exactly that: a fatal PHP error may have occurred while editing the file – perhaps due to the changes you made, or possibly because of file permissions. Check your hosting provider’s error log for details. There, you should be able to identify the cause, which will also reveal the solution.
Tip: Try disabling all plugins as a test – security plugins, in particular, are likely interfering here.
Thread Starter
yarr2
(@yarr2)
It’s definitely not a permissions issue – I can modify and save css, js, txt files, but not php, if a non-block theme is active. If theme is not active then its php files can be updated.
If active theme is a child, then php files both in child and parent themes can’t be updated.
I have similar setup with 6.9.x and it’s not affected. I just made a new clean setup with 7.1 and noticed that strangeness.
I have no trouble editing PHP files in WordPress 7.1 with a classic theme using the Theme File Editor. I would therefore still suspect that there’s something specific to your project.
What did you find when you checked the error log?
What happened when you deactivated all the plugins? Also check mu-plugins.
Also, as a test, try switching to a different classic theme and see if that works.
Thread Starter
yarr2
(@yarr2)
This strange behavior occurred because website domain name was not resolving on the server…