1. 首页
  2. WordPress 函数手册

get_transient()

get_trackback_url()

检索瞬态的值。
Retrieves the value of a transient.

目录锚点:#说明#返回#源码


说明(Description)

检查permalink是否已启用,如果启用,将检索漂亮的路径。如果未启用永久链接,则使用当前文章的ID并将其附加到要转到的正确页面。


返回(Return)

(string)筛选后的trackback URL。


源码(Source)

/**
 * Get the value of a transient.
 *
 * If the transient does not exist, does not have a value, or has expired,
 * then the return value will be false.
 *
 * @since 2.8.0
 *
 * @param string $transient Transient name. Expected to not be SQL-escaped.
 * @return mixed Value of transient.
 */
function get_transient( $transient ) {

 	/**
	 * Filter the value of an existing 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
	 * of the transient, returning the passed value instead.
	 *
	 * @since 2.8.0
	 *
	 * @param mixed $pre_transient The default value to return if the transient does not exist.
	 *                             Any value other than false will short-circuit the retrieval
	 *                             of the transient, and return the returned value.
	 */
	$pre = apply_filters( 'pre_transient_' . $transient, false );
	if ( false !== $pre )
		return $pre;

	if ( wp_using_ext_object_cache() ) {
		$value = wp_cache_get( $transient, 'transient' );
	} else {
		$transient_option = '_transient_' . $transient;
		if ( ! defined( 'WP_INSTALLING' ) ) {
			// If option is not in alloptions, it is not autoloaded and thus has a timeout
			$alloptions = wp_load_alloptions();
			if ( !isset( $alloptions[$transient_option] ) ) {
				$transient_timeout = '_transient_timeout_' . $transient;
				$timeout = get_option( $transient_timeout );
				if ( false !== $timeout && $timeout < time()="" )="" {="" delete_option(="" $transient_option="" );="" delete_option(="" $transient_timeout="" );="" $value="false;" }="" }="" }="" if="" (="" !="" isset(="" $value="" )="" )="" $value="get_option(" $transient_option="" );="" }="" *="" *="" filter="" an="" existing="" transient's="" value.="" *="" *="" the="" dynamic="" portion="" of="" the="" hook="" name,="" `$transient`,="" refers="" to="" the="" transient="" name.="" *="" *="" @since="" 2.8.0="" *="" *="" @param="" mixed="" $value="" value="" of="" transient.="" */="" return="" apply_filters(="" 'transient_'="" .="" $transient,="" $value="" );="" }="">
更新版本 源码位置 使用 被使用
1.5.0 wp-includes/option.php:682 17 9

get_transient() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_transient/

发表评论

您的电子邮箱地址不会被公开。