wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_delete_object_term_relationships › WordPress Function
Since2.3.0
已弃用n/a
› wp_delete_object_term_relationships ( $object_id, $taxonomies )
参数: (2) |
|
定义在: |
|
文档: |
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.Related Functions: wp_set_object_terms, wp_get_object_terms, update_object_term_cache, wp_remove_object_terms, wp_add_object_terms
源码
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 ); } }