I'm running this code to tell me what plugins need updating:

$update_plugins = get_site_transient('update_plugins');

Here is an example return:

    [login-lockdown/loginlockdown.php] => stdClass Object
            [id] => 3760
            [slug] => login-lockdown
            [new_version] => v1.5
            [url] => http://wordpress.org/extend/plugins/login-lockdown/
            [package] => http://downloads.wordpress.org/plugin/login-lockdown.1.5.zip


From that it doesn't tell me the name of the plugin that needs updating. Is there a WordPress function that you can feed the plugin file name like: ogin-lockdown/loginlockdown.php and return the plugin name? In this case I'd want Login LockDown to be returned.


I think you'll have to work via get_plugins(). It will return a list of all plugins in your plugin folder, indexed by plugin location - which is the same as your array index. This is also what the plugin administration table uses.

If you only need the data from one file you could also call get_plugin_data() directly. get_plugins() basically just calls that function in a loop, and caches the result.

| improve this answer | |

Link to the plugin that displays a table listing all plugins that need an update in the admin footer: https://gist.github.com/995560

| improve this answer | |
  • Thanks kaiser for the fully fledged code but I was already able to get done what I needed from Jan's answer. – Scott May 27 '11 at 16:15
  • n/p. Another plugin :) – kaiser May 27 '11 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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