delete_site_transient
Delete a site transient.
Description
delete_site_transient( (string) $transient );
Parameters (1)
- 0. $transient (string)
- Transient name. Expected to not be SQL-escaped.
Usage
if ( !function_exists( 'delete_site_transient' ) ) { require_once ABSPATH . WPINC . '/option.php'; } // Transient name. Expected to not be SQL-escaped. $transient = ''; // NOTICE! Understand what this does before running. $result = delete_site_transient($transient);
Defined (1)
The function is defined in the following location(s).
- /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() ) {
- $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;
- }