Make WordPress Core


Ignore:
Timestamp:
06/08/2015 07:44:32 PM (9 years ago)
Author:
boonebgorges
Message:

Filter out empty object_types in register_taxonomy_for_object_type().

This prevents weird edge bugs when registering an existing taxonomy with an
object type when the taxonomy was previously associated with no object types.

Fixes #32590.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/taxonomy.php

    r31457 r32709  
    239239
    240240    }
     241
     242    /**
     243     * @ticket 32590
     244     */
     245    public function test_register_taxonomy_for_post_type_for_taxonomy_with_no_object_type_should_filter_out_empty_object_types() {
     246        register_taxonomy( 'wptests_tax', '' );
     247        register_taxonomy_for_object_type( 'wptests_tax', 'post' );
     248        $tax = get_taxonomy( 'wptests_tax' );
     249
     250        $expected = array( 'post' );
     251        $this->assertEqualSets( $expected, $tax->object_type );
     252    }
     253
    241254    /**
    242255     * @ticket 25706
Note: See TracChangeset for help on using the changeset viewer.