get_plugin_updates() WordPress Function

The get_plugin_updates() function is used to check for updates to plugins that are installed on a WordPress site. This function will return an array of plugin objects, each of which contains information about the latest version of the plugin and whether or not an update is available.

get_plugin_updates() #


Return

(array)


Top ↑

Source

File: wp-admin/includes/update.php

377
378
379
380
381
382
383
384
385
386
387
388
389
function get_plugin_updates() {
    $all_plugins     = get_plugins();
    $upgrade_plugins = array();
    $current         = get_site_transient( 'update_plugins' );
    foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) {
        if ( isset( $current->response[ $plugin_file ] ) ) {
            $upgrade_plugins[ $plugin_file ]         = (object) $plugin_data;
            $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ];
        }
    }
 
    return $upgrade_plugins;
}


Top ↑

Changelog

Changelog
VersionDescription
2.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.