wpseek.com
A WordPress-centric search engine for devs and theme authors
find_core_auto_update › WordPress Function
Since3.7.0
Deprecatedn/a
› find_core_auto_update ( No parameters )
Returns: |
|
Defined at: |
|
Codex: |
Gets the best available (and enabled) Auto-Update for WordPress core.
If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the installation allows it, else, 1.2.3.Related Functions: find_core_update, list_core_update, wp_maybe_auto_update, core_auto_updates_settings, undismiss_core_update
Source
function find_core_auto_update() { $updates = get_site_transient( 'update_core' ); if ( ! $updates || empty( $updates->updates ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $auto_update = false; $upgrader = new WP_Automatic_Updater(); foreach ( $updates->updates as $update ) { if ( 'autoupdate' !== $update->response ) { continue; } if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) { continue; } if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) { $auto_update = $update; } } return $auto_update; }