clean_object_term_cache( int|array $object_ids, array|string $object_type )
- Since
- 2.3.0
- Source
wp-includes/taxonomy.php:3621
Removes the taxonomy relationship to terms from the cache.
Description
Will remove the entire taxonomy relationship containing term
$object_id. The term IDs have to exist within the taxonomy $object_type for the deletion to take place.Parameters
$object_idsint|array- Single or list of term object ID(s).
$object_typearray|string- The taxonomy object type.
Hooks fired · 1
One hook fires while clean_object_term_cache() runs, in this order:
- do_action( clean_object_term_cache )actionline 3648 (+27 into the body)
Fires after the object term cache has been cleaned.
Uses · 4
- get_object_taxonomies()Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.
- wp_cache_delete_multiple()Deletes multiple values from the cache in one call.
- wp_cache_set_terms_last_changed()Sets the last changed time for the 'terms' cache group.
- do_action()Calls the callback functions that have been added to an action hook.
Used by · 4
- clean_attachment_cache()Will clean the attachment in the cache.
- clean_bookmark_cache()Deletes the bookmark cache.
- clean_post_cache()Will clean the post in the cache.
- wp_delete_term()Removes a term from the database.
Source
function clean_object_term_cache( $object_ids, $object_type ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( ! is_array( $object_ids ) ) { $object_ids = array( $object_ids ); } $taxonomies = get_object_taxonomies( $object_type ); foreach ( $taxonomies as $taxonomy ) { wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" ); } wp_cache_set_terms_last_changed(); /** * Fires after the object term cache has been cleaned. * * @since 2.5.0 * * @param array $object_ids An array of object IDs. * @param string $object_type Object type. */ do_action( 'clean_object_term_cache', $object_ids, $object_type );}History
Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/taxonomy.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.