Ticket #29614: 29614.diff
File 29614.diff, 1.3 KB (added by , 9 years ago) |
---|
-
src/wp-includes/taxonomy.php
2947 2947 if ( '' == trim($name) ) 2948 2948 return new WP_Error('empty_term_name', __('A name is required for this term')); 2949 2949 2950 if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) { 2951 return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); 2952 } 2953 2950 2954 $empty_slug = false; 2951 2955 if ( empty( $args['slug'] ) ) { 2952 2956 $empty_slug = true; -
tests/phpunit/tests/term.php
702 702 $cat_id2 = $this->factory->category->create( array( 'parent' => $cat_id1 ) ); 703 703 $this->assertWPError( $cat_id2 ); 704 704 } 705 706 /** 707 * @ticket 29614 708 */ 709 function test_orphan_category_update() { 710 $cat_id1 = $this->factory->category->create(); 711 $cat_id2 = $this->factory->category->create( array( 'parent' => $cat_id1 ) ); 712 713 wp_delete_category( $cat_id1 ); 714 715 $cat_id2 = wp_update_term( $cat_id2, 'category', array( 'parent' => $cat_id1 ) ); 716 $this->assertWPError( $cat_id2 ); 717 718 } 705 719 }