delete_transient()

delete_transient()函数是Wordpress函数,删除瞬态。

参数(Parameters)

参数类型必填说明
$transient(string)必需暂时的名字。应为非SQL转义。

返回(Return)

(bool)如果成功则为true,否则为false


源码(Source)

/**
 * Delete a transient.
 *
 * @since 2.8.0
 *
 * @param string $transient Transient name. Expected to not be SQL-escaped.
 * @return bool true if successful, false otherwise
 */
function delete_transient( $transient ) {
	/**
	 * Fires immediately before a specific transient is deleted.
	 *
	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
	 *
	 * @since 3.0.0
	 *
	 * @param string $transient Transient name.
	 */
	do_action( 'delete_transient_' . $transient, $transient );
	if ( wp_using_ext_object_cache() ) {
		$result = wp_cache_delete( $transient, 'transient' );
	} else {
		$option_timeout = '_transient_timeout_' . $transient;
		$option = '_transient_' . $transient;
		$result = delete_option( $option );
		if ( $result )
			delete_option( $option_timeout );
	}
	if ( $result ) {
		/**
		 * Fires after a transient is deleted.
		 *
		 * @since 3.0.0
		 *
		 * @param string $transient Deleted transient name.
		 */
		do_action( 'deleted_transient', $transient );
	}
	return $result;
}
更新版本源码位置使用被使用
2.8.0wp-includes/option.php:63286

笔记(Notes)

通过编辑术语挂钩清除瞬态

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索