| 1289 | /** |
| 1290 | * @ticket 45121 |
| 1291 | * @group 45121 |
| 1292 | */ |
| 1293 | function test_update_post_should_not_modify_tag() { |
| 1294 | $args = array( |
| 1295 | 'slug' => 'wp_update_post_tag_1', |
| 1296 | ); |
| 1297 | wp_insert_term( 'wp_update_post_tag', 'post_tag', $args ); |
| 1298 | |
| 1299 | $args = array( |
| 1300 | 'slug' => 'wp_update_post_tag_2', |
| 1301 | ); |
| 1302 | $term2 = wp_insert_term( 'wp_update_post_tag', 'post_tag', $args ); |
| 1303 | |
| 1304 | $args = array( |
| 1305 | 'slug' => 'wp_update_post_tag_3', |
| 1306 | ); |
| 1307 | $term3 = wp_insert_term( 'wp_update_post_tag', 'post_tag', $args ); |
| 1308 | |
| 1309 | $postarr = array( |
| 1310 | 'post_title' => 'Test wp_update_post', |
| 1311 | 'post_status' => 'publish', |
| 1312 | 'tags_input' => array( $term2[ 'term_id' ], $term3[ 'term_id' ] ), |
| 1313 | ); |
| 1314 | |
| 1315 | $post_id = wp_insert_post( $postarr ); |
| 1316 | |
| 1317 | $post = get_post( $post_id ); |
| 1318 | wp_update_post( $post ); |
| 1319 | $tags = wp_get_post_tags( $post->ID ); |
| 1320 | |
| 1321 | $this->assertSame( $term2[ 'term_id' ], $tags[0]->term_id ); |
| 1322 | $this->assertSame( $term3[ 'term_id' ], $tags[1]->term_id ); |
| 1323 | } |
| 1324 | |