AnsPress_Prod_Updater::check_update( array $_transient_data )
Description #
Check for Updates at the defined API endpoint and modify the update array.
This function dives into the update API just when WordPress creates its update array, then adds a custom API call and injects the custom plugin data retrieved from the API. It is reassembled from parts of the native WordPress plugin update code. See wp-includes/update.php line 121 for the original wp_update_plugins() function.
Parameters #
- $_transient_dataarray (Required) Update array build by WordPress.
Source #
File: admin/updater.php
function check_update( $_transient_data ) { if ( $this->update_checked ) { return $_transient_data; } $this->update_checked = true; global $pagenow; if ( ! is_object( $_transient_data ) ) { $_transient_data = new stdClass(); } if ( 'plugins.php' == $pagenow && is_multisite() ) { return $_transient_data; } if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { $_transient_data->response[ $this->name ] = $version_info; } $_transient_data->last_checked = time(); $_transient_data->checked[ $this->name ] = $this->version; } } return $_transient_data; }
Expand full source code Collapse full source code View on GitHub: admin/updater.php:129
Add your comment