Skip Navigation

[Resolved] function.php edit loops as from WP 4.9

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Bruno Simon 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#592615

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

#592709

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.

#592721

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.

#592725
edit3.JPG

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?

#592828

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.

#593155

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/

#594614

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.