WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

I think I am late but as per new guidelines I found this is best possible solution

   // Set the arguments. For brevity of code, I will set only a few fields.
    $args = array(
        'slug' => 'akismet', // or any plugin slug
        'fields' => array(
            'version' => true

    // Make request and extract plug-in object. Action is query_plugins
    $response = wp_remote_post(
            'body' => array(
                'action' => 'plugin_information',
                'request' => serialize((object)$args)
    if ( !is_wp_error($response) ) {
        $returned_object = unserialize(wp_remote_retrieve_body($response));   

        if ($returned_object) {
            $downloaded = $returned_object->downloaded;
        else {
            // Response body does not contain an object/array
            echo "An error has occurred.";
    else {
        // Error object returned
        echo "An error has occurred";
share|improve this answer

Your Answer


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.