Changeset 32117
- Timestamp:
- 04/13/2015 01:20:57 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r32047 r32117 3366 3366 global $wpdb; 3367 3367 3368 if ( ! taxonomy_exists($taxonomy) ) 3369 return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); 3368 if ( ! taxonomy_exists( $taxonomy ) ) { 3369 return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); 3370 } 3370 3371 3371 3372 $term_id = (int) $term_id; 3372 3373 3373 3374 // First, get all of the original args 3374 $term = get_term ($term_id, $taxonomy, ARRAY_A);3375 3376 if ( is_wp_error( $term ) ) 3375 $term = get_term( $term_id, $taxonomy, ARRAY_A ); 3376 3377 if ( is_wp_error( $term ) ) { 3377 3378 return $term; 3379 } 3380 3381 if ( ! $term ) { 3382 return new WP_Error( 'invalid_term', __( 'Empty Term' ) ); 3383 } 3378 3384 3379 3385 // Escape data pulled from DB. -
trunk/tests/phpunit/tests/term/wpUpdateTerm.php
r31812 r32117 654 654 _unregister_taxonomy( 'wptests_tax' ); 655 655 } 656 657 /** 658 * @ticket 31954 659 */ 660 public function test_wp_update_term_with_null_get_term() { 661 $t = $this->factory->term->create( array( 'taxonomy' => 'category' ) ); 662 $found = wp_update_term( $t, 'post_tag', array( 'slug' => 'foo' ) ); 663 664 $this->assertWPError( $found ); 665 $this->assertSame( 'invalid_term', $found->get_error_code() ); 666 } 667 656 668 }
Note: See TracChangeset
for help on using the changeset viewer.