^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_core_updates()用法示例

get_core_updates( array $options = array() )

Get available core updates.


描述


参数

$options

(array)
(Optional)
Set $options[‘dismissed’] to true to show dismissed upgrades too, set $options[‘available’] to false to skip not-dismissed updates.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

Default value: array()


返回值

(array|false) Array of the update objects on success, false on failure.


源代码

File: wp-admin/includes/update.php

function get_core_updates( $options = array() ) {
	$options = array_merge( array( 'available' => true, 'dismissed' => false ), $options );
	$dismissed = get_site_option( 'dismissed_update_core' );

	if ( ! is_array( $dismissed ) )
		$dismissed = array();

	$from_api = get_site_transient( 'update_core' );

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

	$updates = $from_api->updates;
	$result = array();
	foreach ( $updates as $update ) {
		if ( $update->response == 'autoupdate' )
			continue;

		if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) {
			if ( $options['dismissed'] ) {
				$update->dismissed = true;
				$result[] = $update;
			}
		} else {
			if ( $options['available'] ) {
				$update->dismissed = false;
				$result[] = $update;
			}
		}
	}
	return $result;
}

Collapse full 源代码 code

View on Trac


相关函数

Uses

  • wp-includes/option.php:
    get_site_transient()
  • wp-includes/option.php:
    get_site_option()

Used By

  • wp-admin/includes/update.php:
    get_preferred_from_update_core()
  • wp-admin/update-core.php:
    list_core_update()
  • wp-admin/update-core.php:
    dismissed_updates()
  • wp-admin/update-core.php:
    core_upgrade_preamble()
  • wp-admin/update-core.php:
    list_plugin_updates()
  • wp-includes/update.php:
    wp_get_update_data()
  • Show 1 more used by
    Hide more used by


让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈