Make WordPress Core

Ticket #51657: 51657.diff

File 51657.diff, 951 bytes (added by audrasjb, 4 years ago)

Themes: Correct displaying the _doing_it_wrong() message for add_theme_support( 'html5' )

  • src/wp-includes/theme.php

    diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
    index 916c836f43..5fe2234321 100644
    a b function add_theme_support( $feature, ...$args ) { 
    25322532
    25332533                case 'html5':
    25342534                        // You can't just pass 'html5', you need to pass an array of types.
    2535                         if ( empty( $args[0] ) ) {
     2535                        if ( ! isset( $args[0] ) || ! is_array( $args[0] ) || empty( $args[0] ) ) {
     2536                                _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' );
     2537
    25362538                                // Build an array of types for back-compat.
    25372539                                $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
    2538                         } elseif ( ! isset( $args[0] ) || ! is_array( $args[0] ) ) {
    2539                                 _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' );
    2540                                 return false;
    25412540                        }
    25422541
    25432542                        // Calling 'html5' again merges, rather than overwrites.