WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/delete transient

Description

Delete a transient. If the specified transient does not exist then no action will be taken.

Usage

<?php delete_transient$transient ); ?>

Parameters

$transient
(string) (required) Transient name. Expected to not be SQL-escaped.
Default: None

Return Values

(boolean) 
True if successful, false otherwise.

Examples

Clearing our transient via the edit_term hook

<?php
// Create a simple function to delete our transient
function edit_term_delete_transient() {
     delete_transient( 'special_query_results' );
}
// Add the function to the edit_term hook so it runs when categories/tags are edited
add_action( 'edit_term', 'edit_term_delete_transient' );
?>

Notes

Change Log

Since: 2.8

Source File

delete_transient() is located in wp-includes/option.php.

Related

Transients API: set_transient(), get_transient(), delete_transient(), set_site_transient(), get_site_transient(), delete_site_transient()

See also index of Function Reference and index of Template Tags.