• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / clean_object_term_cache() – Removes the taxonomy relationship to terms from the cache.

You appear to be a bot. Output may be restricted

Description

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.

Usage

clean_object_term_cache( $object_ids, $object_type );

Parameters

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

Returns

void

Source

File name: wordpress/wp-includes/taxonomy.php
Lines:

1 to 29 of 29
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 ( $object_ids as $id ) {
    foreach ( $taxonomies as $taxonomy ) {
      wp_cache_delete( $id, "{$taxonomy}_relationships" );
    }
  }

  
/**
 * 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 );
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: clean_object_term_cache
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/taxonomy.php
File ref: wp-includes/taxonomy.php
Deprecated?: No
API Letters: C,O,T

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites