WordPress函数:delete_transient 删除临时值

江河/ 2023年09月29日/ WordPress/ 浏览 439

函数原型:


delete_transient( string $transient ): bool


删除临时值。


参数说明:


$transient,临时值名称。


函数源码:


function delete_transient( $transient ) {
	do_action( "delete_transient_{$transient}", $transient );

	if ( wp_using_ext_object_cache() || wp_installing() ) {
		$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 ) {
		do_action( 'deleted_transient', $transient );
	}

	return $result;
}


包含钩子:


do_action( 'deleted_transient', string $transient )

do_action( "delete_transient_{$transient}", string $transient )


发表评论

暂无评论,抢个沙发...

客服 工单