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.

git-svn-id: https://develop.svn.wordpress.org/trunk@32709 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-06-08 19:44:32 +00:00
parent b3660e2731
commit 036c33caaa
2 changed files with 16 additions and 0 deletions
+13
View File
@@ -238,6 +238,19 @@ class Tests_Taxonomy extends WP_UnitTestCase {
_unregister_post_type( $post_type );
}
/**
* @ticket 32590
*/
public function test_register_taxonomy_for_post_type_for_taxonomy_with_no_object_type_should_filter_out_empty_object_types() {
register_taxonomy( 'wptests_tax', '' );
register_taxonomy_for_object_type( 'wptests_tax', 'post' );
$tax = get_taxonomy( 'wptests_tax' );
$expected = array( 'post' );
$this->assertEqualSets( $expected, $tax->object_type );
}
/**
* @ticket 25706
*/