Support » Developing with WordPress » How to disable “loopback request checks for sandbox” via functions.php?

  • I am in a bit of a mess here.

    I have been working on a wordpress theme that is online but hidden from the rest of the internet basically… the site can’t even check itself to see if it exists… because of a hack in my local hosts file.

    So naturally, these “loopback request checks” are failing whenever I try to edit a php file on my active theme, and I am being prevented from easily editing this active theme.

    Is there anything I can do to my functions.php file to prevent loopback request checks from happening? At least until I complete the theme and load it up onto a live website?

    I have no plugins installed, and I am unable to edit my active theme.

    EDIT: Could it be as simple as forcing https://developer.wordpress.org/reference/functions/wp_remote_retrieve_body/ to always return a string? I am going to try that right now…

    • This topic was modified 1 week, 2 days ago by  247pinger.
Viewing 2 replies - 1 through 2 (of 2 total)
  • This worked for me:

    I edited line 492 of wp-admin/includes/file.php right now from:

    if ( $is_active && ‘php’ === $extension ) {

    TO

    if ( $is_active && ‘php’ === $extension && false) {

    And now I am able to edit my hidden website’s theme files just as I was prior to updating to 4.9! Yippee!

    Moderator bcworkz

    (@bcworkz)

    I’m glad you found a solution. I’ll assume you realize that if you should incorrectly update a file using your hack that the entire site could crash and the only way to fix it would be to FTP a correction. Avoiding this situation is the entire reason why a sandbox check was added. Anyone doing the same needs to recognize this risk.

    You probably also realize that your hack will be overwritten the next time WP is updated, which is in part why altering core files is strongly discouraged. It is your site after all, you are free to do with it as you wish. But suggesting others may wish to do the same without disclosing the risks involved is a bit irresponsible. Now that I’ve done so for you, it’s all good 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.