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
| Flag | Description |
|---|---|
KEY | Transient name to delete |
--network | Delete a network transient |
--all | Delete 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
| Command | What It Removes |
|---|---|
wp transient delete KEY | One specific transient |
wp transient delete --all | Every transient |
wp transient delete-expired | Only 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
wp transient delete-expired— remove only expired transients.wp cache flush— flush the full object cache.