i need to get a list of all updates the wp site need (core, plugin and themes). i already know about wp_get_update_data(), but it give me back only the number. i need to get for example:

plugin1 | actual version | new version

plugin2 | actual version | new version

theme1 | actual version | new version

wp | actual version | new version

how can i save that information into some arrays to use them?

edit: i managed to do this with what i found but it doesn't work, it print to try only test

function data_report()
    // Get theme info
    $theme_data = wp_get_theme();
    $theme = $theme_data->Name . ' ' . $theme_data->Version;

    // Get plugins that have an update
    $updates = get_plugin_updates();

    // WordPress active plugins
    $fin_plug = "\n" . '-- WordPress Active Plugins' . "\n\n";
    $plugins = get_plugins();
    $active_plugins = get_option('active_plugins', array());
    foreach ($plugins as $plugin_path => $plugin) {
        if (!in_array($plugin_path, $active_plugins)) {
        $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
        $fin_plug .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";


add_action( 'wp_footer', 'stampa_prova' );

function stampa_prova (){   
        echo 'test';
        $cospi = data_report();
        echo $cospi;

3 Answers 3


When on the admin view you can use the following functions to get update data.

If you want to build your own functions, then you can get update related data from site transients update_themes, update_plugins, and update_core. Then you can compare the plugin and theme transients with the theme and plugin arrays you can get with wp_get_themes() and get_plugins(). The above functions are more or less wrappers for these transients and functions.

Have a look at the source for the functions to see how WP handles this stuff.

  • i tried to use the 3 function u linked, but they don' t give me anything back
    – DevBeppe
    Feb 6, 2020 at 14:40

The answer made by Antti Koskinen is great. It helped me to make a function to get the plugins info for a custom API endpoint, I hope it can help somebody else

    function system_check() {
        if (!function_exists('get_plugins')) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
        if (!function_exists('get_site_transient')) {
            require_once ABSPATH . 'wp-admin/includes/option.php';
        $updates = get_site_transient('update_plugins');
        $plugins = get_plugins();
        $the_list = array();
        $i = 1;
        if ($updates->response) {
            $the_list["ultima_revision"] = date("Y-m-d g:i A", intval($updates->last_checked));
            foreach ($plugins as $name => $plugin) {
                $the_list["plugins"][$i]["id"] = $name;
                $the_list["plugins"][$i]["name"] = $plugin["Name"];
                $the_list["plugins"][$i]["current_version"] = $plugin["Version"];
                if (isset($updates->response[$name])) {
                    $the_list["plugins"][$i]["update"] = "yes";
                    $the_list["plugins"][$i]["version"] = $updates->response[$name]->new_version;
                } else {
                    $the_list["plugins"][$i]["update"] = "no";
        return $the_list;
  • 1
    Your answer looks good to me. Thanks Feb 11, 2022 at 7:03
  • Thank you for this function. This working function for plugins. I need same type of function for themes. So that I can get themes data from rest api.
    – shiv
    May 30, 2022 at 11:38

solved, if someone need the code i posted work, need only to add the admin permission to execute with require_once

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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