Ticket #34413: 34413.3.diff
File 34413.3.diff, 1.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/taxonomy-functions.php
442 442 unset( $args['capabilities'] ); 443 443 444 444 $args['name'] = $taxonomy; 445 $args['object_type'] = array_unique( (array) $object_type );446 445 446 if ( isset( $wp_taxonomies[ $taxonomy ] ) ) { 447 $args['object_type'] = array_merge( $wp_taxonomies[ $taxonomy ]->object_type, (array) $object_type ); 448 } else { 449 $args['object_type'] = (array) $object_type; 450 } 451 452 $args['object_type'] = array_unique( $args['object_type'] ); 453 447 454 $args['labels'] = get_taxonomy_labels( (object) $args ); 448 455 $args['label'] = $args['labels']->name; 449 456 -
tests/phpunit/tests/taxonomy.php
251 251 $this->assertEqualSets( $expected, $tax->object_type ); 252 252 } 253 253 254 /** 255 * @ticket 34413 256 */ 257 public function test_register_taxonomy_subsequent_calls_should_not_overwrite_previously_registered_object_types() { 258 register_taxonomy( 'wptests_tax', 'post' ); 259 register_taxonomy( 'wptests_tax', 'page' ); 260 261 $tax = get_taxonomy( 'wptests_tax' ); 262 263 $expected = array( 'post', 'page' ); 264 $this->assertEqualSets( $expected, $tax->object_type ); 265 } 266 254 267 public function test_get_objects_in_term_should_return_invalid_taxonomy_error() { 255 268 $terms = get_objects_in_term( 1, 'invalid_taxonomy' ); 256 269 $this->assertInstanceOf( 'WP_Error', $terms );