delete_site_transient() WordPress Function
The delete_site_transient() function deletes a transient record from the database. A transient is a piece of data that is stored in the database for a limited amount of time. This function takes two arguments: the transient name and a site identifier. The site identifier is used to differentiate between sites in a multisite network.
delete_site_transient( string $transient ) #
Deletes a site transient.
Parameters
- $transient
(string)(Required)Transient name. Expected to not be SQL-escaped.
Return
(bool) True if the transient was deleted, false otherwise.
Source
File: wp-includes/option.php
function delete_site_transient( $transient ) {
/**
* Fires immediately before a specific site 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_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 ) {
/**
* Fires after a transient is deleted.
*
* @since 3.0.0
*
* @param string $transient Deleted transient name.
*/
do_action( 'deleted_site_transient', $transient );
}
return $result;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |