wp_delete_object_term_relationships() – Will unlink the object from the taxonomy or taxonomies.
You appear to be a bot. Output may be restricted
Description
Unlinks the object from the taxonomy or taxonomies.
Will remove all relationships between the object and any terms in a particular taxonomy or taxonomies. Does not remove the term or taxonomy itself.
Usage
wp_delete_object_term_relationships( $object_id, $taxonomies );
Parameters
- $object_id
- ( int ) required – The term object ID that refers to the term.
- $taxonomies
- ( string|array ) required – List of taxonomy names or single taxonomy name.
Returns
void
Source
File name: wordpress/wp-includes/taxonomy.php
Lines:
1 to 13 of 13
function wp_delete_object_term_relationships( $object_id, $taxonomies ) { $object_id = (int) $object_id; if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( (array) $taxonomies as $taxonomy ) { $term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) ); $term_ids = array_map( 'intval', $term_ids ); wp_remove_object_terms( $object_id, $term_ids, $taxonomy ); } }