删除瞬态。

原型

delete_transient( string $transient )

参数

$transient (string) (Required) 瞬态名称。预计不会被SQL转义。

返回值

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

源文件

路径:wp-includes/option.php

<?php
...
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;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/delete_transient/