find_core_update()WP 2.7.0

Finds the available update for WordPress core.

Хуков нет.

Возвращает

Объект|false. The core update offering on success, false on failure.

Использование

find_core_update( $version, $locale );
$version(строка) (обязательный)
Version string to find the update for.
$locale(строка) (обязательный)
Locale to find the update for.

Список изменений

С версии 2.7.0 Введена.

Код find_core_update() WP 6.5.2

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;
}