Wp transient list (WP-CLI)
Naar navigatie springen
Naar zoeken springen
Retrieve a list of all transients.
What I'm usually looking for:
wp transient list --fields=name,expiration
or
wp transient list --fields=name
$ wp help transient list NAME wp transient list DESCRIPTION Lists transients and their values. SYNOPSIS wp transient list [--search=<pattern>] [--exclude=<pattern>] [--network] [--unserialize] [--human-readable] [--fields=<fields>] [--format=<format>] OPTIONS [--search=<pattern>] Use wildcards ( * and ? ) to match transient name. [--exclude=<pattern>] Pattern to exclude. Use wildcards ( * and ? ) to match transient name. [--network] Get the values of network|site transients. On single site, this is a specially-named cache key. On multisite, this is a global cache (instead of local to the site). [--unserialize] Unserialize transient values in output. [--human-readable] Human-readable output for expirations. [--fields=<fields>] Limit the output to specific object fields. [--format=<format>] The serialization format for the value. --- default: table options: - table - json - csv - count - yaml --- AVAILABLE FIELDS This field will be displayed by default for each matching option: * name * value * expiration EXAMPLES # List all transients $ wp transient list +------+-------+---------------+ | name | value | expiration | +------+-------+---------------+ | foo | bar | 39 mins | | foo2 | bar2 | no expiration | | foo3 | bar2 | expired | | foo4 | bar4 | 4 hours | +------+-------+---------------+
Retrieve the number of transients
$ wp transient list --format=count 55
Retrieve names & expiration
Sometimes, there are too many transients to list them. In such cases, you probably can still list the names & expiration. E.g:
$ wp transient list --fields=name,expiration +------------------------------------------------+------------+ | name | expiration | +------------------------------------------------+------------+ | external_ip_address_127.0.0.1 | 1702103150 | | is_multi_author | false | | jetpack_autoloader_plugin_paths | false | | mollie-wc-7c7fd13383d7bdd9fb85fb4d52aed37f | 1702024071 | | mollie-wc-97faeb95a2be897a6f43353c4e62bf4d | 1702024070 | | wc_attribute_taxonomies | false | | wc_layered_nav_counts_pa_asxxx-code | 1702109758 | | wc_layered_nav_counts_pa_automatic-stop | 1702109759 | | wc_layered_nav_counts_pa_connector | 1702109759 | | wc_layered_nav_counts_pa_depth-mm | 1702109758 | | wc_layered_nav_counts_pa_device | 1702109757 | | wc_layered_nav_counts_pa_diagram | 1702109760 | | wc_layered_nav_counts_pa_length-mm | 1702109759 | | wc_layered_nav_counts_pa_model | 1702109757 | | wc_layered_nav_counts_pa_original-xxxxxxxxxxxx | 1702109760 | | wc_layered_nav_counts_pa_product-line | 1702109760 | | wc_layered_nav_counts_pa_spring | 1702109759 | | wc_layered_nav_counts_pa_submodel | 1702109758 | | wc_layered_nav_counts_pa_wire | 1702109759 | | wc_term_counts | 1704609377 | | woocommerce_blocks_asset_api_script_data | 1704615358 | | woocommerce_blocks_asset_api_script_data_ssl | 1704615360 | | woocommerce_webhook_ids_status_active | false | +------------------------------------------------+------------+
These names are the actual names of transients, e.g., to delete them:
wp transient delete wc_layered_nav_counts_pa_asein-code
Example: See if there are any wc_layered_nav_counts
transients:
wp transient list --fields=name,expiration | grep wc_layered_nav_counts