Make WordPress Core


Ignore:
Timestamp:
10/27/2020 07:58:10 PM (3 years ago)
Author:
helen
Message:

Post Formats: You have to pass an array of supported post formats.

This shows a _doing_it_wrong() message and also returns false instead of true if no array of formats is passed in add_theme_support(), avoiding a PHP error.

Post formats maintainership comes full circle. 🙃

Props Mista-Flo, sproutchris, garrett-eclipse.
Fixes #51390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r49214 r49344  
    24822482 * @since 5.5.0 The `core-block-patterns` feature was added and is enabled by default.
    24832483 * @since 5.5.0 The `custom-logo` feature now also accepts 'unlink-homepage-logo'.
     2484 * @since 5.6.0 The `post-formats` feature now returns doing it wrong if no array is passed
    24842485 *
    24852486 * @global array $_wp_theme_features
     
    25242525
    25252526                $args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
     2527            } else {
     2528                _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of types.' ), '5.6.0' );
     2529                return false;
    25262530            }
    25272531            break;
Note: See TracChangeset for help on using the changeset viewer.