So you’re facing this problem in your WordPress but you have no idea on how to deal with the loopback request failed on error ? You’re at the right place !
Some users are facing the error “the loopback request failed” when trying to edit a file with the built int file editor, and there are several potential causes.
You may see there is a problem when checking your site health saying “your site could not complete a loopback request.
I was fed up of reading everywhere “disable all plugin and themes, and then active them one by one to see which one causes the problem”. This method is indeed the right one, but what if you need all of these plugins / themes ?
For me, and several users I saw on threads, the cause comes from WooCommerce and related plugins (booking plugins to be precise, and it worked fine until some update). I could see it in the site health, but it also went that I was no more able to edit files in theme editor.
A new plugin to rule them all ?
Some user advice to add a plugin dedicated to edit themes and plugins files. It could solve my initial problem, but in my opinion, why would we use a plugin when this functionality is built in ?
Here are some of these plugins when browsing the WordPress plugin directory :
None of them has my preference, so choose wisely.
Note it does not solve the loopback issue but only the file editor one.
The pro is that a WordPress update will not reset the fix described after !
How to deal with the loopback request failed on error ?
Here is a small and quick code fix that consists to tell WordPress the validation of the file edited succeeded and remove the error loopback request failed. It is not the best fix but it works too.
First, connect to your hosting through FTP, then locate the file /wp-admin/includes/file.php
At line 525 (valid for Worpress 6.4), find the line below
1 2 3 4 5 |
if ( $is_active && 'php' === $extension ) { ... } |
And edit like this (add the “&& false” condition).
1 2 3 4 5 |
if ( $is_active && 'php' === $extension && false ) { ... } |
Note it does not solve the loopback issue neither but only the edit one.
The pro is that it’s quick and easy but another not negligible problem is that in this case, a WordPress update will reset the fix and you’ll need to do it again.
What is the best solution ?
While browsing google, I actually still not find an official fix for this issue, so you have to make your choice and keep in mind it does not solve the real problem.
Choose what fits you best, maybe you’re not at ease with the code and add a new plugin is easier for you.
If you find a lasting solution to this issue, I would be happy to get it and add it in this post.
On my website problem was related to Cloudflare Anti-bot shield, which was blocking a lot of wordpress native functions. Just FYI, if anyone is looking for solution
Thanks Dorian for your information, from my side, I was not using Cloudflare when I faced this issue.