0
votes

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.

I keep getting the error every time I try to edit my theme functions.php file within the Wordpress theme editor, however I am able to edit other files within the theme just fine like the CSS and template pages.

I also checked to see if functions.php in other themes have the same issue; they do except the default theme like twentytwenty I am able to actually edit the functions.php so I'm not sure what is going on.

I checked to see if the file permissions are low, they are set at 644 and the folders are 755. I checked to see if define( 'DISALLOW_FILE_EDIT', true ); it is not.

I did a fresh install of wordpress and uploaded my theme again, without plugins and got the same situation.

I cleared function.php entirely and I was able to save it being empty, however when adding the code back part by part previously accepted code seems to trigger the error again.

I installed an untouched version of the theme and still get the error when previously this never happened.

2
First check for errors in the browser console when saving the file. Also try editing in a different browser. Maybe something was cached.Maksym Kotov

2 Answers

0
votes

If you have ftp access to root - try it via a FTP Program like fileZilla and connect to the Server - mostly the best and easiest way

0
votes

So basically I switched off ModSecurity from my cPanel and that actually did the trick. No more error messages and I am now able to freely edit.

I recently changed hosting provider so hence why previously I never got the error messages. I am not exactly sure why ModSecurity is causing this, so I thought I'd share how at least I got it to work.