I'm trying to get a automatic plugin updater work on localhost, I had it working at one point on a live server but for some reason mid update it gives me an error of:

An error occurred while updating Test Plugin: Download failed. A valid URL was not provided.

I've tested the URL it gives me above the error message and in the log; both download the zip file containing the plugin immediately.

The below object gets passed to the plugins_api filter.

stdClass Object
    [slug] => test-plugin.php
    [path] => test-plugin/test-plugin.php
    [name] => Test Plugin
    [new_version] => 2.0
    [last_updated] => March 20, 2015 04:27pm
    [sections] => Array
            [description] => test
            [changelog] => <strong>test</strong>

    [download_link] =>

So, if I can get to the zip by visiting the URL directly, and the object seems to correspond mostly to what WP receives from other plugins, these two factors lead me to believe that the issue has something to do with localhost.

The plugin path matches the installation file:


Edit :: I can follow the URL in the error which downloads the zip file to my browser then turn around and install that zip to my black WP plugins without a problem. Really seems like localhost.

So white is the install holding the updated plugin, black has the outdated plugin and sending the request to get the new update.

Am I missing anything in the object I'm passing? Are there any caveats to WordPress being on localhost that could affect this?

  • I'm not sure if [path] is valid. I use [plugin_name] with a value of the base plugin folder; and [slug] is the main file of my plugin (without the .php).
    – josh
    Commented Mar 21, 2015 at 2:27
  • @josh Thanks for the suggestion, I tried it but still giving me the same error. Pastebin Object
    – Howdy_McGee
    Commented Mar 21, 2015 at 2:45
  • Try this Pastebin. Since your plugin name and root folder are the same; the [plugin_name] and [slug] should be the same.
    – josh
    Commented Mar 21, 2015 at 2:48
  • @josh - Same issue saying invalid URL. I even tried mixing in path with your pastebin but neither changed the outcome unfortunately.
    – Howdy_McGee
    Commented Mar 21, 2015 at 2:53
  • 1
    Hmmm... I've never hosted on localhost; only on my live server. But I did encounter an error message when downloading; and making the change mentioned above fixed it for me. Perhaps there is something in localhost? I'm not sure. I'd by happy to jump in chat and see if we can figure it out.
    – josh
    Commented Mar 21, 2015 at 3:05

1 Answer 1


As it turns out there's a difference between and localhost. Once I change my requests to:


and a few other instances of the IP version, the update worked like a charm. Stack Overflow has some good answers on why this could be: What is the difference between and localhost?

  • 1
    You can solve this specific issue by adding an hosts file entry that resolves "localhost" to
    – gmazzap
    Commented Mar 21, 2015 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.