[wp-trac] [WordPress Trac] #51657: Correct displaying the _doing_it_wrong() message for add_theme_support( 'html5' )

WordPress Trac noreply at wordpress.org
Wed Oct 28 15:41:37 UTC 2020


#51657: Correct displaying the _doing_it_wrong() message for add_theme_support(
'html5' )
----------------------------+-----------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  defect (bug)    |      Status:  accepted
 Priority:  normal          |   Milestone:  5.7
Component:  Themes          |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+-----------------------------
Description changed by SergeyBiryukov:

Old description:

> Background: #24932, #51390.
>
> As a result of [25193], [25235], and [25785] `add_theme_support( 'html5'
> )` is supposed to return `false` and display a `_doing_it_wrong()`
> notice: "You need to pass an array of types".
>
> As far as I can tell, this has never worked as expected, due to `!
> is_array( $args[0] )` check being in the `elseif` condition after `empty(
> $args[0] )`, which always succeeds in this case.
>
> Currently, calling `add_theme_support( 'html5' )` without passing an
> array of supported types just silently falls back to `array( 'comment-
> list', 'comment-form', 'search-form' )`, without any indication that it
> is not the recommended approach.

New description:

 Background: #24932, #51390.

 As a result of [25193], [25235], and [25785] `add_theme_support( 'html5'
 )` is supposed to return `false` and display a `_doing_it_wrong()` notice:
 "You need to pass an array of types".

 As far as I can tell, this has never worked as expected, due to `!
 is_array( $args[0] )` check being in the `elseif` condition after `empty(
 $args[0] )`, which always succeeds in this case.

 Currently, calling `add_theme_support( 'html5' )` without passing an array
 of supported types just silently falls back to `array( 'comment-list',
 'comment-form', 'search-form' )` for backward compatibility, without any
 indication that it is not the recommended approach.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51657#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list