Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to take a plugin slug (e.g. 'akismet') of a plugin that is NOT currently installed and somehow retrieve the download URL of the current version (e.g. 'http://downloads.wordpress.org/plugin/akismet.2.5.3.zip')?

This is for a command line script I am trying to develop that will enable plugin installation from the command line.

share|improve this question
add comment

1 Answer 1

I forget exactly if the plugin slug is a reliable method to get the url, it might be in most cases but not all due to how plugins are named.

You can query the api @wordpress.org for the plugins xml file which also contains the download link.

For example:

$plugin_slug = 'akismet'; 
$return_plugin_info = "http://api.wordpress.org/plugins/info/1.0/$plugin_slug.xml"

It will return an XML file you can parse for the download link, which is in <download_link type="string">the link...akismet.zip</download>

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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