diff --git a/src/wp-includes/class-wp-post-type.php b/src/wp-includes/class-wp-post-type.php
index ba37a02..558bddd 100644
|
a
|
b
|
final class WP_Post_Type { |
| 513 | 513 | */ |
| 514 | 514 | public function add_supports() { |
| 515 | 515 | if ( ! empty( $this->supports ) ) { |
| 516 | | add_post_type_support( $this->name, $this->supports ); |
| | 516 | foreach ( $this->supports as $support => $features ) { |
| | 517 | if ( is_array( $features ) ) { |
| | 518 | add_post_type_support( $this->name, $support, $features ); |
| | 519 | } else { |
| | 520 | add_post_type_support( $this->name, $features ); |
| | 521 | } |
| | 522 | } |
| 517 | 523 | unset( $this->supports ); |
| 518 | 524 | } elseif ( false !== $this->supports ) { |
| 519 | 525 | // Add default features. |
diff --git a/tests/phpunit/tests/post/wpPostType.php b/tests/phpunit/tests/post/wpPostType.php
index a9d046e..c9ca3c2 100644
|
a
|
b
|
class Tests_WP_Post_Type extends WP_UnitTestCase { |
| 50 | 50 | $this->assertEqualSets( array(), $post_type_supports_after ); |
| 51 | 51 | } |
| 52 | 52 | |
| | 53 | /** |
| | 54 | * Test that supports can optionally receive nested args. |
| | 55 | */ |
| | 56 | public function test_add_supports_custom_with_args() { |
| | 57 | $post_type = 'cpt'; |
| | 58 | $post_type_object = new WP_Post_Type( $post_type, array( |
| | 59 | 'supports' => array( |
| | 60 | 'support_with_args' => array( |
| | 61 | 'arg1', |
| | 62 | 'arg2', |
| | 63 | ), |
| | 64 | 'support_without_args', |
| | 65 | ), |
| | 66 | ) ); |
| | 67 | |
| | 68 | $post_type_object->add_supports(); |
| | 69 | $post_type_supports = get_all_post_type_supports( $post_type ); |
| | 70 | |
| | 71 | $post_type_object->remove_supports(); |
| | 72 | $post_type_supports_after = get_all_post_type_supports( $post_type ); |
| | 73 | |
| | 74 | $this->assertEqualSets( array( |
| | 75 | 'support_with_args' => array( |
| | 76 | array( |
| | 77 | 'arg1', |
| | 78 | 'arg2', |
| | 79 | ), |
| | 80 | ), |
| | 81 | 'support_without_args' => true, |
| | 82 | ), $post_type_supports ); |
| | 83 | $this->assertEqualSets( array(), $post_type_supports_after ); |
| | 84 | } |
| | 85 | |
| 53 | 86 | public function test_does_not_add_query_var_if_not_public() { |
| 54 | 87 | $this->set_permalink_structure( '/%postname%' ); |
| 55 | 88 | |