Languages: English • delete object term relationships 日本語 (Add your language)
Will unlink 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 the taxonomy itself.
<?php wp_delete_object_term_relationships( $object_id, $taxonomies ); ?>
This function does not return a value.
Delete all tag relationships for a post:
<?php $post_id = 55; wp_delete_object_term_relationships( $post_id, 'post_tag' ); // Post 55 now has no tags. ?>
Delete multiple taxonomies' relationships for a post:
<?php $post_id = 55; $taxonomies = array( 'category', 'post_tag', 'custom_taxonomy' ); wp_delete_object_term_relationships( $post_id, $taxonomies ); ?>
Since: 2.3.0
wp_delete_object_term_relationships() is located in wp-includes/taxonomy.php
.