I use the following code in my PHP script to automatically download the latest version of WordPress...

$wordpress_zip_file_url = 'https://wordpress.org/latest.zip';
file_put_contents("wordpress.zip", file_get_contents($wordpress_zip_file_url));

Does this work for plugins the same way? For example, I'd like to automatically download the latest backupwordpress plugin version --> https://wordpress.org/plugins/backupwordpress/

Is there a generic link to download the latest version of a plugin?

  • Hmm good question.. I don't know of a latest.zip option for plugins and can't immediately see one; you might need to hook into the Wordpress plugin management system to grab the URL. It'll be possible, but you might need to trawl through how core does it to work it out.
    – Tim Malone
    Commented May 2, 2016 at 22:02

3 Answers 3



The structure should be the same for all WordPress.org plugins and the link you're looking for is:


You can see an example here on how this might be used.

To update plugins through WP-CLI:

wp plugin update backupwordpress
  • 2
    Nice and clean! I didn't know that a latest-stable link existed. This should be the answer.
    – Luis Sanz
    Commented May 3, 2016 at 12:07
  • 1
    good to know, just tested other patterns like {slug}.latest.zip and {slug}.trunk.zip but that didn't work ;-)
    – birgire
    Commented May 3, 2016 at 12:59

Sounds like what you are really after is wp-cli which will let you write shell script that automate such tasks.

  • I would also recommend this. Maybe you could add an example to extend the answer ;-)
    – birgire
    Commented May 3, 2016 at 13:00
  • LOL @birgire, I leave the long answer to the heros of this site :) but maybe will updtae later if will not forget Commented May 3, 2016 at 13:07

When you're doing a plugin update, in the process where it shows you all the steps, you can also see the plugin download url. Usually the last version can be always found there.

  • But what if you always just want to download the latest version by accessing a URL that never changes?
    – cpcdev
    Commented May 2, 2016 at 23:25

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.