函数原型
find_core_update( string $version, string $locale ): object|false
函数描述
Finds the available update for WordPress core.
是否弃用
未弃用
函数参数
-
$version
string
Required - Version string to find the update for.
-
$locale
string
Required - Locale to find the update for.
函数返回值
object|false The core update offering on success, false on failure.
函数位置
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |

