Skip to main content

wp transient delete

Overview

Remove a specific transient by key — immediately invalidating the cached value and forcing the next request to regenerate it from the source. Use this for targeted cache invalidation without flushing the entire transient store.

Syntax

wp transient delete <key> [--network] [--all]

Options

FlagDescription
KEYTransient name to delete
--networkDelete a network transient
--allDelete all transients (regular and expired)

Basic Usage

Delete a single transient

wp transient delete my_api_cache

Output:

Success: Transient deleted.

Delete a transient that doesn't exist

wp transient delete nonexistent_key

Output:

Warning: Transient "nonexistent_key" not found (perhaps it expired?).

Delete all transients

wp transient delete --all

Output:

Success: 42 transients deleted from the database.

Real-World Scenarios

Force-refresh a plugin's API data

# Clear the cached exchange rate so it re-fetches from the API
wp transient delete plugin_exchange_rate
echo "Exchange rate transient cleared. Will refresh on next page load."

Clear all transients after a content migration

wp transient delete --all
wp cache flush
echo "All transients and object cache cleared."

Clear a network transient after multisite settings change

wp transient delete update_core --network

delete vs delete-expired

CommandWhat It Removes
wp transient delete KEYOne specific transient
wp transient delete --allEvery transient
wp transient delete-expiredOnly expired transients

Quick Reference

wp transient delete <key>                 # Delete one
wp transient delete --all # Delete all
wp transient delete <key> --network # Network transient

Next Steps