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?
3 s
https://downloads.wordpress.org/plugin/{plugin-name}.latest-stable.zip
The structure should be the same for all WordPress.org plugins and the link you’re looking for is:
https://downloads.wordpress.org/plugin/backupwordpress.latest-stable.zip
.
You can see an example here on how this might be used.
To update plugins through WP-CLI:
wp plugin update backupwordpress