I am trying to: edit my fuction.php file from admin
Link to a page where the issue can be seen:
I expected to see: the file saved as before
Instead, I got: an indefinite loop leading to a 504 gateway timeout error, although the file seems something to be saved anyhow.
Hi, as from version4.9, it appeared the WP core team has implemented some verification process to avoid blanking sites.
There is an ongoing discussion about this issue here: https://wordpress.org/support/topic/cant-edit-main-theme-php-files-after-upgrading-to-4-9/page/7/
From this lengthy discussion, the people at WP seem to blame plugins such as PODS (somehow a competitor to Toolset).
Do you guys also experiment anything like this?
Thanks
Dear Bruno,
We don't recommend you to edit theme files in the wordpress dashboard:
It is not safe, if you add wrong PHP codes, it will produce the PHP errors and the "504 gateway timeout error", so I suggest you use FTP tools to login your website, download theme file and edit it in your own computer, then upload it.
Hello Yang,
That is probably why the people at WP did implement this new checking feature, so your recommendation, although wise, is less true than with previous versions of WP.
However, the 504 gateway error occurs even when saving function.php without any modification (since wp4.9); this is not normal and should be checked.
Thanks.
I suggest you check your theme file “function.php”, there might be some broken PHP codes when you save it in wordpress dashboard, if there is, you will need to restore it back from your website backup.
And I just test it in my localhost, edit theme file function.php in wordpress dashboard, I get a error message:
Sorry, that file cannot be edited.
See screenshot: edit3.JPG
Is there any step missing?
Hi Yang,
Indeed, I got this message on another website too (using Toolset), but here I only get a loop when saving even though the validation seems ok. (If I alter something on purpose, then the validation check provides me with the debugging info and, of course, prevents me from saving the file).
Something is really strange here.
Thanks.
We don't recommend editing theme file in wordpress dashboard, and even wordpress 4.9 prevents doing this too, and if you need to add PHP codes in wordpress dashboard, you can try other plugin, for example:
Code Snippets
https://wordpress.org/plugins/code-snippets/
Well, if WP strongly advises not to edit in WP, I wonder why they put so much effort into developing a code verification tool...
Anyhow, the problem seemed to be on their side eventually, as since the recent update (v4.9.1), all is working fine again.
Thanks for your time.