WordPress函数:delete_site_transient 删除站点的临时值

江河/ 2023年09月30日/ WordPress/ 浏览 1121

函数原型:


delete_site_transient( string $transient ): bool


删除站点的临时值。


函数源码:


function delete_site_transient( $transient ) {
	do_action( "delete_site_transient_{$transient}", $transient );

	if ( wp_using_ext_object_cache() || wp_installing() ) {
		$result = wp_cache_delete( $transient, 'site-transient' );
	} else {
		$option_timeout = '_site_transient_timeout_' . $transient;
		$option         = '_site_transient_' . $transient;
		$result         = delete_site_option( $option );

		if ( $result ) {
			delete_site_option( $option_timeout );
		}
	}

	if ( $result ) {
		do_action( 'deleted_site_transient', $transient );
	}

	return $result;
}


包含钩子:


do_action( 'deleted_site_transient', string $transient )

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


发表评论

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

客服 工单