find_core_update() WordPress Function

The find_core_update() function is used to check if a new version of WordPress is available. If an update is available, it will return an object with the update information.

find_core_update( string $version, string $locale ) #

Finds the available update for WordPress core.


Parameters

$version

(string)(Required)Version string to find the update for.

$locale

(string)(Required)Locale to find the update for.


Top ↑

Return

(object|false) The core update offering on success, false on failure.


Top ↑

Source

File: wp-admin/includes/update.php

function find_core_update( $version, $locale ) {
	$from_api = get_site_transient( 'update_core' );

	if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
		return false;
	}

	$updates = $from_api->updates;
	foreach ( $updates as $update ) {
		if ( $update->current == $version && $update->locale == $locale ) {
			return $update;
		}
	}
	return false;
}


Top ↑

Changelog

Changelog
VersionDescription
2.7.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.