Ticket #51320: 51320.diff
File 51320.diff, 1.5 KB (added by , 4 years ago) |
---|
-
src/wp-includes/post.php
4091 4091 if ( ! empty( $tax_object->default_term ) ) { 4092 4092 4093 4093 // Filter out empty terms. 4094 if ( isset( $postarr['tax_input'] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {4094 if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) { 4095 4095 $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] ); 4096 4096 } 4097 4097 -
tests/phpunit/tests/post.php
929 929 } 930 930 931 931 /** 932 * @ticket 51320 933 */ 934 function test_create_post_with_taxonomies() { 935 $post_type = 'test_post_type'; 936 $tax1 = 'test_tax1'; 937 $tax2 = 'test_tax2'; 938 939 register_post_type( $post_type, array( 'taxonomies' => array( $tax1, $tax2 ) ) ); 940 register_taxonomy( $tax1, $post_type, array( 'default_term' => 'term_1' ) ); 941 register_taxonomy( $tax2, $post_type, array( 'default_term' => 'term_2' ) ); 942 943 $post_id = self::factory()->post->create( array( 'post_type' => $post_type ) ); 944 945 $taxonomies = get_post_taxonomies( $post_id ); 946 947 $this->assertContains( $tax1, $taxonomies ); 948 $this->assertContains( $tax2, $taxonomies ); 949 } 950 951 /** 932 952 * @ticket 21212 933 953 */ 934 954 function test_utf8mb3_post_saves_with_emoji() {