diff --git src/wp-includes/class-wp-taxonomy.php src/wp-includes/class-wp-taxonomy.php
index e749eef..a753b78 100644
|
|
final class WP_Taxonomy { |
332 | 332 | $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); |
333 | 333 | unset( $args['capabilities'] ); |
334 | 334 | |
335 | | $args['object_type'] = array_unique( (array) $object_type ); |
| 335 | $args['object_type'] = array_values( array_unique( (array) $object_type ) ); |
336 | 336 | |
337 | 337 | // If not set, use the default meta box |
338 | 338 | if ( null === $args['meta_box_cb'] ) { |
diff --git tests/phpunit/tests/taxonomy/getObjectTaxonomies.php tests/phpunit/tests/taxonomy/getObjectTaxonomies.php
index 2c0710d..b5a3ba8 100644
|
|
class Tests_Taxonomy_GetObjectTaxonomies extends WP_UnitTestCase { |
81 | 81 | $this->assertInternalType( 'object', $found['wptests_tax2'] ); |
82 | 82 | $this->assertSame( 'wptests_tax2', $found['wptests_tax2']->name ); |
83 | 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @ticket 42209 |
| 87 | */ |
| 88 | public function test_should_ensure_sequential_array_index_of_post_types() { |
| 89 | register_taxonomy( 'foo', array( |
| 90 | 0 => 'post', |
| 91 | 1 => 'page', |
| 92 | ) ); |
| 93 | register_taxonomy( 'bar', array( |
| 94 | 0 => 'post', |
| 95 | 2 => 'page', |
| 96 | ) ); |
| 97 | |
| 98 | $foo = get_taxonomy( 'foo' ); |
| 99 | $bar = get_taxonomy( 'bar' ); |
| 100 | |
| 101 | $expected = array( 'post', 'page' ); |
| 102 | |
| 103 | $this->assertSame( $expected, $foo->object_type ); |
| 104 | $this->assertSame( $expected, $bar->object_type ); |
| 105 | } |
84 | 106 | } |