clean_object_term_cache

Definition:
function clean_object_term_cache($object_ids, $object_type) {}

Removes the taxonomy relationship to terms from the cache.
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

  • int|array $object_ids: Single or list of term object ID(s)
  • array|string $object_type: The taxonomy object type

Source code

function clean_object_term_cache($object_ids, $object_type) {

	if ( !is_array($object_ids) )

		$object_ids = array($object_ids);



	foreach ( $object_ids as $id )

		foreach ( get_object_taxonomies($object_type) as $taxonomy )

			wp_cache_delete($id, "{$taxonomy}_relationships");

623

clean_comment_cache

Definition:
function clean_comment_cache($ids) {}

Removes comment ID from the comment cache.

Parameters

  • int|array $ids: Comment ID or array of comment IDs to remove from cache

Source code

function clean_comment_cache($ids) {

	foreach ( (array) $ids as $id )

		wp_cache_delete($id, 'comment');



	wp_cache_set('last_changed', time(), 'comment');

}

621

clean_category_cache

Definition:
function clean_category_cache( $id ) {}

Remove the category cache data based on ID.

Parameters

  • int $id: Category ID

Source code

function clean_category_cache( $id ) {

	clean_term_cache( $id, 'category' );

}

619

clean_bookmark_cache

Definition:
function clean_bookmark_cache($bookmark_id) {}

Deletes bookmark cache

Parameters

  • $bookmark_id

Source code

function clean_bookmark_cache($bookmark_id) {

	wp_cache_delete( $bookmark_id, 'bookmark' );

	wp_cache_delete( 'get_bookmarks', 'bookmark' );

}

617

clean_attachment_cache

Definition:
function clean_attachment_cache($id, $clean_terms = false) {}

Will clean the attachment in the cache.
Cleaning means delete from the cache. Optionally will clean the term object cache associated with the attachment ID.

Parameters

  • int $id: The attachment ID in the cache to clean
  • bool $clean_terms: optional. Whether to clean terms cache

Defined actions

  • clean_attachment_cache
    do_action('clean_attachment_cache', $id);

Source code

function clean_attachment_cache($id, $clean_terms = false) {

	global $_wp_suspend_cache_invalidation;



	if ( !empty($_wp_suspend_cache_invalidation) )

		return;



	$id = (int) $id;



	wp_cache_delete($id, 'posts');

	wp_cache_delete($id, 'post_meta');



	if ( $clean_terms )

		clean_object_term_cache($id, 'attachment');



	do_action('clean_attachment_cache', $id);

}

615