diff --git a/wp-includes/post.php b/wp-includes/post.php index 37106b3d29..55527fea85 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3196,13 +3196,7 @@ function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $a $tags = array_unique( array_map( 'intval', $tags ) ); } - $r = wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); - if ( is_wp_error( $r ) ) - return $r; - - wp_cache_delete( $post_id, $taxonomy . '_relationships' ); - - return $r; + return wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); } /** diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 1760df24e2..1932bab383 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2238,6 +2238,8 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) { return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error ); } + wp_cache_delete( $object_id, $taxonomy . '_relationships' ); + do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids); return $tt_ids; }