Ticket #36666: 36666.3.diff
File 36666.3.diff, 2.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/theme.php
1831 1831 * 1832 1832 * @since 3.0.0 1833 1833 * @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. 1836 1837 */ 1837 function remove_theme_support( $feature ) {1838 function remove_theme_support( $feature, $args = array() ) { 1838 1839 // Blacklist: for internal registrations not used directly by themes. 1839 1840 if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) ) 1840 1841 return false; 1841 1842 1842 return _remove_theme_support( $feature );1843 return _remove_theme_support( $feature, $args ); 1843 1844 } 1844 1845 1845 1846 /** … … 1852 1853 * @global Custom_Image_Header $custom_image_header 1853 1854 * @global Custom_Background $custom_background 1854 1855 * 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. 1856 1859 */ 1857 function _remove_theme_support( $feature ) {1860 function _remove_theme_support( $feature, $args = array() ) { 1858 1861 global $_wp_theme_features; 1859 1862 1860 1863 switch ( $feature ) { … … 1887 1890 remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); 1888 1891 unset( $GLOBALS['custom_background'] ); 1889 1892 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; 1890 1909 } 1891 1910 1892 1911 unset( $_wp_theme_features[ $feature ] );