On this page
delete_site_transient( string $transient ): bool
Deletes a site transient.
Parameters
$transientstring 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. View all references
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;
}
Hooks
- do_action( 'deleted_site_transient',
string $transient ) -
Fires after a transient is deleted.
- do_action( "delete_site_transient_{$transient}",
string $transient ) -
Fires immediately before a specific site transient is deleted.
Related
Uses
| Uses | Description |
|---|---|
| wp_installing() wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| wp_cache_delete() wp-includes/cache.php | Removes the cache contents matching key and group. |
| wp_using_ext_object_cache() wp-includes/load.php | Toggle |
| delete_site_option() wp-includes/option.php | Removes a option by name for the current network. |
| do_action() wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
Used By
| Used By | Description |
|---|---|
| wp_clean_update_cache() wp-includes/update.php | Clears existing update caches for plugins, themes, and core. |
| Core_Upgrader::upgrade() wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| delete_theme() wp-admin/includes/theme.php | Removes a theme. |
| install_plugin_install_status() wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| wp_clean_plugins_cache() wp-admin/includes/plugin.php | Clears the plugins cache used by get_plugins() and by default, the plugin updates cache. |
| update_core() wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| wp_clean_themes_cache() wp-includes/theme.php | Clears the cache held by get_theme_roots() and WP_Theme. |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_site_transient