list_plugin_updates()
- Since
- 2.9.0
- Source
wp-admin/update-core.php:462
Compatibility
- WordPress
- since 2.9.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to list_plugin_updates() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Scales with input
- Instructions
- 77–88
- Plugin surface
- None
- Called by
- 0
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 359.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- optionnetwork option
get_site_option()called directly - transienttransient
get_site_transient()one call below list_plugin_updates() - hookthird-party callbacks
apply_filters()one call below list_plugin_updates()
Further down the call graph this can also reach cache, serialize and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost list_plugin_updates() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($plugins) && !isset($value) && !wp_is_auto_update_enabled_for_type() | 77–78 | wp_get_wp_version(), get_plugin_updates(), get_core_updates(), __(), number_format_i18n(), printf(), _e(), esc_url(), wp_nonce_field(), esc_attr_e(), _e(), wp_is_auto_update_enabled_for_type(), _e(), esc_attr_e() |
!empty($plugins) && !isset($value) && wp_is_auto_update_enabled_for_type() | 87–88 | wp_get_wp_version(), get_plugin_updates(), get_core_updates(), __(), number_format_i18n(), printf(), _e(), esc_url(), wp_nonce_field(), esc_attr_e(), _e(), wp_is_auto_update_enabled_for_type(), get_site_option(), wp_get_auto_update_message(), _e(), esc_attr_e() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 363 | 81–92 | 23 | 4 more instructions than PHP 8.5 |
| 8.5 | 359 | 77–88 | 23 | |
| 8.4 | 359 | 77–88 | 23 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 365 | 80–91 | 23 | |
| 8.2 | 365 | 80–91 | 23 | |
| 8.1 | 365 | 80–91 | 23 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 366 | 80–91 | 23 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 19
- wp_get_wp_version()Returns the current WordPress version.
- get_plugin_updates()Retrieves plugins with updates available.
- __()Retrieves the translation of $text.
- get_core_updates()Gets available core updates.
- number_format_i18n()Converts float number to format based on the locale.
- _e()Displays translated text.
- esc_url()Checks and cleans a URL.
- wp_nonce_field()Retrieves or display nonce hidden field for forms.
- esc_attr_e()Displays translated text that has been escaped for safe use in an attribute.
- wp_is_auto_update_enabled_for_type()Checks whether auto-updates are enabled.
- get_site_option()Retrieve an option value for the current network based on name of option.
- wp_get_auto_update_message()Determines the appropriate auto-update message to be displayed.
Show all 19
- _get_plugin_data_markup_translate()Sanitizes plugin data, optionally adds markup, optionally translates.
- is_php_version_compatible()Checks compatibility with the current PHP version.
- current_user_can()Returns whether the current user has the specified capability.
- wp_get_update_php_url()Gets the URL to learn more about updating the PHP version the site is running on.
- wp_get_update_php_annotation()Returns the default annotation for the web hosting altering the "Update PHP" page URL.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- esc_attr()Escaping for HTML attributes.
Source code
function list_plugin_updates() { $wp_version = wp_get_wp_version(); $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version ); require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $plugins = get_plugin_updates(); if ( empty( $plugins ) ) { echo '<h2>' . __( 'Plugins' ) . '</h2>'; echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; return; } $form_action = 'update-core.php?action=do-plugin-upgrade'; $core_updates = get_core_updates(); if ( ! isset( $core_updates[0]->response ) || 'latest' === $core_updates[0]->response || 'development' === $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=' ) ) { $core_update_version = false; } else { $core_update_version = $core_updates[0]->current; } $plugins_count = count( $plugins ); ?><h2> <?php printf( '%s <span class="count">(%d)</span>', __( 'Plugins' ), number_format_i18n( $plugins_count ) ); ?></h2><p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p><form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> <?php wp_nonce_field( 'upgrade-core' ); ?><p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p><table class="widefat updates-table" id="update-plugins-table"> <thead> <tr> <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td> <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td> </tr> </thead> <tbody class="plugins"> <?php $auto_updates = array(); if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $auto_update_notice = ' | ' . wp_get_auto_update_message(); } foreach ( (array) $plugins as $plugin_file => $plugin_data ) { $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; $preferred_icons = array( 'svg', '2x', '1x', 'default' ); foreach ( $preferred_icons as $preferred_icon ) { if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; break; } } // Get plugin compat for running version of WordPress. if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { /* translators: %s: WordPress version. */ $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version ); } else { /* translators: %s: WordPress version. */ $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version ); } // Get plugin compat for updated version of WordPress. if ( $core_update_version ) { if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { /* translators: %s: WordPress version. */ $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version ); } else { /* translators: %s: WordPress version. */ $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version );Changelog
Introduced in 2.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/update-core.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.