WordPress.org

Make WordPress Core

Ticket #36666: 36666.3.diff

File 36666.3.diff, 2.1 KB (added by flixos90, 5 years ago)

updated patch

  • src/wp-includes/theme.php

     
    18311831 *
    18321832 * @since 3.0.0
    18331833 * @see add_theme_support()
    1834  * @param string $feature the feature being added
    1835  * @return bool|void Whether feature was removed.
     1834 * @param string $feature The feature being added.
     1835 * @param array $args Array of specific arguments to remove. Optional.
     1836 * @return bool|void Whether the feature was removed.
    18361837 */
    1837 function remove_theme_support( $feature ) {
     1838function remove_theme_support( $feature, $args = array() ) {
    18381839        // Blacklist: for internal registrations not used directly by themes.
    18391840        if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) )
    18401841                return false;
    18411842
    1842         return _remove_theme_support( $feature );
     1843        return _remove_theme_support( $feature, $args );
    18431844}
    18441845
    18451846/**
     
    18521853 * @global Custom_Image_Header $custom_image_header
    18531854 * @global Custom_Background   $custom_background
    18541855 *
    1855  * @param string $feature
     1856 * @param string $feature The feature being added.
     1857 * @param array $args Array of specific arguments to remove. Optional.
     1858 * @return bool|void Whether the feature was removed.
    18561859 */
    1857 function _remove_theme_support( $feature ) {
     1860function _remove_theme_support( $feature, $args = array() ) {
    18581861        global $_wp_theme_features;
    18591862
    18601863        switch ( $feature ) {
     
    18871890                        remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
    18881891                        unset( $GLOBALS['custom_background'] );
    18891892                        break;
     1893
     1894                case 'post-formats':
     1895                case 'post-thumbnails':
     1896                        if ( $args && is_bool( $_wp_theme_features[ $feature ] ) )
     1897                                return false;
     1898
     1899                // This also applies to 'post-formats' and 'post-thumbnails' if they haven't returned yet.
     1900                case 'html5' :
     1901                        if ( $args ) {
     1902                                $_wp_theme_features[ $feature ][0] = array_diff( $_wp_theme_features[ $feature ][0], $args );
     1903
     1904                                // Return only if there is still something in the feature array.
     1905                                if ( ! empty( $_wp_theme_features[ $feature ][0] ) )
     1906                                        return true;
     1907                        }
     1908                        break;
    18901909        }
    18911910
    18921911        unset( $_wp_theme_features[ $feature ] );