clean_object_term_cache()
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.
Хуки из функции
Возвращает
null
. Ничего (null).
Использование
clean_object_term_cache( $object_ids, $object_type );
- $object_ids(int|массив) (обязательный)
- Single or list of term object ID(s).
- $object_type(массив|строка) (обязательный)
- The taxonomy object type.
Заметки
- Global. true|false. $_wp_suspend_cache_invalidation
- Смотрите: get_object_taxonomies() for more on $object_type.
Список изменений
С версии 2.3.0 | Введена. |
Код clean_object_term_cache() clean object term cache WP 6.6.2
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 ); }