WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

I am having an issue finding out how to display the number of plugins/updates available to call somewhere else other than the admin header. I found the function wp_get_update_data should be what I need:

How is the " wp_get_update_data " function used?

However, I wasn't sure how to get this to display as an actual count of the total plugins and updates available or any working example on the internet of how to use it.

Any suggestions would be much appreciated.

share|improve this question
up vote 7 down vote accepted

Here's an example of the data returned from the wp_get_update_data() function:

    [counts] => Array
            [plugins] => 3
            [themes] => 2
            [wordpress] => 0
            [translations] => 0
            [total] => 5

    [title] => 3 Plugin Updates, 2 Theme Updates

So the number of available plugin updates should be available with:

// Number of available plugin updates:
$update_data = wp_get_update_data();
echo $update_data['counts']['plugins'];


To display the following plugin info in the admin area:

There are available updates for 3 plugins out of 22

we can additionally use the get_plugins() function:

if ( ! function_exists( 'get_plugins' ) )
    require_once ABSPATH . 'wp-admin/includes/plugin.php';

$data = array( 
    'updates'   =>  $update_data['counts']['plugins'],
    'total'     =>  count( get_plugins() ),

    "There are available updates for <strong>%d</strong> plugins  
     out of <strong>%d</strong>",

We can add more info, in a similar way, with get_mu_plugins() and get_dropins().

share|improve this answer
Sorry, but I had to undelete your answer. It adds slightly different information and clearly has its value. I hope you understand that. – kaiser Aug 18 '14 at 16:46
@kaiser if you say so ;-) I updated the answer to make it a little bit different from the other one. – birgire Aug 18 '14 at 18:37
Worked perfectly, thank you for taking the time to explain in more detail! – Tom Aug 18 '14 at 22:08

wp_get_update_data() returns an array in this format

  • counts
    • plugins
    • themes
    • wordpress
    • translations
    • total
  • title

So, if you want total count, you need to use it like this

$updates = wp_get_update_data();
echo $updates['counts']['total'];
share|improve this answer
You just beat me to it by few seconds, so I will remove my answer (+1) – birgire Aug 18 '14 at 16:38
@birgire Great sportmanship. +1 – Pieter Goosen Aug 18 '14 at 16:40

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.