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

wordpress函数get_site_transient()用法示例

get_site_transient( string $transient )

Get the value of a site transient.


描述

If the transient does not exist, does not have a value, or has expired, then the return value will be false.

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


参数

$transient

(string)
(Required)
Transient name. Expected to not be SQL-escaped.


返回值

(mixed) Value of transient.


源代码

File: wp-includes/option.php

function get_site_transient( $transient ) {

	/**
	 * Filters the value of an existing site transient.
	 *
	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
	 *
	 * Passing a truthy value to the filter will effectively short-circuit retrieval,
	 * returning the passed value instead.
	 *
	 * @since 2.9.0
	 * @since 4.4.0 The `$transient` parameter was added.
	 *
	 * @param mixed  $pre_site_transient The default value to return if the site transient does not exist.
	 *                                   Any value other than false will short-circuit the retrieval
	 *                                   of the transient, and return the returned value.
	 * @param string $transient          Transient name.
	 */
	$pre = apply_filters( "pre_site_transient_{$transient}", false, $transient );

	if ( false !== $pre )
		return $pre;

	if ( wp_using_ext_object_cache() ) {
		$value = wp_cache_get( $transient, 'site-transient' );
	} else {
		// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
		$no_timeout = array('update_core', 'update_plugins', 'update_themes');
		$transient_option = '_site_transient_' . $transient;
		if ( ! in_array( $transient, $no_timeout ) ) {
			$transient_timeout = '_site_transient_timeout_' . $transient;
			$timeout = get_site_option( $transient_timeout );
			if ( false !== $timeout && $timeout < time() ) {
				delete_site_option( $transient_option  );
				delete_site_option( $transient_timeout );
				$value = false;
			}
		}

		if ( ! isset( $value ) )
			$value = get_site_option( $transient_option );
	}

	/**
	 * Filters the value of an existing site transient.
	 *
	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
	 *
	 * @since 2.9.0
	 * @since 4.4.0 The `$transient` parameter was added.
	 *
	 * @param mixed  $value     Value of site transient.
	 * @param string $transient Transient name.
	 */
	return apply_filters( "site_transient_{$transient}", $value, $transient );
}

更新日志

Version 描述
2.9.0 Introduced.

相关函数

Uses

  • wp-includes/cache.php:
    wp_cache_get()
  • wp-includes/load.php:
    wp_using_ext_object_cache()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/option.php:
    site_transient_{$transient}
  • wp-includes/option.php:
    delete_site_option()
  • wp-includes/option.php:
    pre_site_transient_{$transient}
  • wp-includes/option.php:
    get_site_option()
  • Show 2 more uses


Used By

  • wp-admin/includes/class-wp-community-events.php:
    WP_Community_Events::get_cached_events()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_update_theme()
  • wp-admin/includes/class-wp-plugin-install-list-table.php:
    WP_Plugin_Install_List_Table::get_installed_plugin_slugs()
  • wp-admin/includes/translation-install.php:
    wp_get_available_translations()
  • wp-admin/includes/class-wp-automatic-updater.php:
    WP_Automatic_Updater::run()
  • wp-admin/includes/class-plugin-upgrader.php:
    Plugin_Upgrader::bulk_upgrade()
  • wp-admin/includes/class-theme-upgrader.php:
    Theme_Upgrader::upgrade()
  • wp-admin/includes/class-theme-upgrader.php:
    Theme_Upgrader::bulk_upgrade()
  • wp-admin/includes/class-plugin-upgrader.php:
    Plugin_Upgrader::upgrade()
  • wp-admin/includes/theme.php:
    wp_prepare_themes_for_js()
  • wp-admin/includes/theme.php:
    get_theme_update_available()
  • wp-admin/includes/theme.php:
    get_theme_feature_list()
  • wp-admin/includes/class-wp-plugins-list-table.php:
    WP_Plugins_List_Table::prepare_items()
  • wp-admin/includes/class-wp-ms-themes-list-table.php:
    WP_MS_Themes_List_Table::prepare_items()
  • wp-admin/includes/update.php:
    get_core_updates()
  • wp-admin/includes/update.php:
    find_core_auto_update()
  • wp-admin/includes/update.php:
    find_core_update()
  • wp-admin/includes/update.php:
    get_plugin_updates()
  • wp-admin/includes/update.php:
    wp_plugin_update_rows()
  • wp-admin/includes/update.php:
    wp_plugin_update_row()
  • wp-admin/includes/update.php:
    get_theme_updates()
  • wp-admin/includes/update.php:
    wp_theme_update_rows()
  • wp-admin/includes/update.php:
    wp_theme_update_row()
  • wp-admin/includes/dashboard.php:
    wp_check_browser_version()
  • wp-admin/includes/plugin-install.php:
    install_popular_tags()
  • wp-admin/includes/plugin-install.php:
    install_plugin_install_status()
  • wp-admin/includes/plugin.php:
    delete_plugins()
  • wp-admin/includes/import.php:
    wp_get_popular_importers()
  • wp-admin/includes/credits.php:
    wp_credits()
  • wp-includes/theme.php:
    get_theme_roots()
  • wp-includes/theme.php:
    search_theme_directories()
  • wp-includes/update.php:
    _maybe_update_plugins()
  • wp-includes/update.php:
    _maybe_update_themes()
  • wp-includes/update.php:
    wp_version_check()
  • wp-includes/update.php:
    wp_update_plugins()
  • wp-includes/update.php:
    wp_update_themes()
  • wp-includes/update.php:
    wp_get_translation_updates()
  • wp-includes/update.php:
    wp_get_update_data()
  • wp-includes/update.php:
    _maybe_update_core()
  • Show 34 more used by
    Hide more used by


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

热门推荐

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

反馈