Advertisements

update_object_term_cache

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

Updates the cache for Term ID(s).
Will only update the cache for terms not already cached.

Parameters

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

Return values

returns:Null value is given with empty $object_ids. False if

Source code

function update_object_term_cache($object_ids, $object_type) {

	if ( empty($object_ids) )

		return;



	if ( !is_array($object_ids) )

		$object_ids = explode(',', $object_ids);



	$object_ids = array_map('intval', $object_ids);



	$taxonomies = get_object_taxonomies($object_type);



	$ids = array();

	foreach ( (array) $object_ids as $id ) {

		foreach ( $taxonomies as $taxonomy ) {

			if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) {

				$ids[] = $id;

				break;

			}

		}

	}

3183

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: