On this page
clean_taxonomy_cache( string $taxonomy )
Cleans the caches for a taxonomy.
Parameters
$taxonomystring Required-
Taxonomy slug.
Source
File: wp-includes/taxonomy.php. View all references
function clean_taxonomy_cache( $taxonomy ) {
wp_cache_delete( 'all_ids', $taxonomy );
wp_cache_delete( 'get', $taxonomy );
wp_cache_delete( 'last_changed', 'terms' );
// Regenerate cached hierarchy.
delete_option( "{$taxonomy}_children" );
_get_term_hierarchy( $taxonomy );
/**
* Fires after a taxonomy's caches have been cleaned.
*
* @since 4.9.0
*
* @param string $taxonomy Taxonomy slug.
*/
do_action( 'clean_taxonomy_cache', $taxonomy );
}
Hooks
- do_action( 'clean_taxonomy_cache',
string $taxonomy ) -
Fires after a taxonomy’s caches have been cleaned.
Related
Uses
| Uses | Description |
|---|---|
| wp_cache_delete() wp-includes/cache.php | Removes the cache contents matching key and group. |
| _get_term_hierarchy() wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| delete_option() wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| do_action() wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
Used By
| Used By | Description |
|---|---|
| clean_term_cache() wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
Changelog
| Version | Description |
|---|---|
| 4.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/clean_taxonomy_cache