Make WordPress Core

Ticket #51390: 51390.3.patch

File 51390.3.patch, 1.6 KB (added by Mista-Flo, 5 years ago)

Improve doc

  • src/wp-includes/theme.php

    diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
    index 5fa7a23146..0866dfc5b4 100644
    a b function get_theme_starter_content() { 
    24752475 *              by adding it to the function signature.
    24762476 * @since 5.5.0 The `core-block-patterns` feature was added and is enabled by default.
    24772477 * @since 5.5.0 The `custom-logo` feature now also accepts 'unlink-homepage-logo'.
     2478 * @since 5.6.0 The `post-formats` feature now returns doing it wrong if no array is passed
    24782479 *
    24792480 * @global array $_wp_theme_features
    24802481 *
    function add_theme_support( $feature, ...$args ) { 
    25172518                                unset( $post_formats['standard'] );
    25182519
    25192520                                $args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
     2521                        } else {
     2522                                _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of types.' ), '5.6.0' );
     2523                                return false;
    25202524                        }
    25212525                        break;
    25222526
  • tests/phpunit/tests/post/formats.php

    diff --git a/tests/phpunit/tests/post/formats.php b/tests/phpunit/tests/post/formats.php
    index 44cedfc9a6..cd4acdcaba 100644
    a b class Tests_Post_Formats extends WP_UnitTestCase { 
    88                parent::setUp();
    99        }
    1010
     11        /**
     12         * @ticket 51390
     13         */
     14        function test_post_format_doing_it_wrong() {
     15                $this->setExpectedIncorrectUsage( "add_theme_support( 'post-formats' )" );
     16
     17                // The second parameter should be an array
     18                $this->assertFalse( add_theme_support( 'post-formats' ) );
     19        }
     20
    1121        function test_set_get_post_format_for_post() {
    1222                $post_id = self::factory()->post->create();
    1323