Here’s an example of the data returned from the wp_get_update_data()
function:
Array
(
[counts] => Array
(
[plugins] => 3
[themes] => 2
[wordpress] => 0
[translations] => 0
[total] => 5
)
Displaying the number of updates available in the Admin area => 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'];
Update:
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() ),
);
printf(
"There are available updates for <strong>%d</strong> plugins
out of <strong>%d</strong>",
$data['updates'],
$data['total']
);
We can add more info, in a similar way, with get_mu_plugins()
and get_dropins()
.