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

February 12, 2011 


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