WordPress.org

Make WordPress Core

Ticket #14077: 14077.7.diff

File 14077.7.diff, 2.1 KB (added by paulwilde, 6 years ago)
  • wp-includes/post.php

    diff --git a/wp-includes/post.php b/wp-includes/post.php
    index e09e1de..a430dba 100644
    a b function _add_post_type_submenus() { 
    17511751 * @global array $_wp_post_type_features
    17521752 *
    17531753 * @param string       $post_type The post type for which to add the feature.
    1754  * @param string|array $feature   The feature being added, accepts an array of
     1754 * @param string|array $features  The feature being added, accepts an array of
    17551755 *                                feature strings or a single string.
    17561756 */
    1757 function add_post_type_support( $post_type, $feature ) {
     1757function add_post_type_support( $post_type, $features ) {
    17581758        global $_wp_post_type_features;
    17591759
    1760         $features = (array) $feature;
    1761         foreach ($features as $feature) {
    1762                 if ( func_num_args() == 2 )
    1763                         $_wp_post_type_features[$post_type][$feature] = true;
    1764                 else
    1765                         $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
     1760        foreach ( (array) $features as $feature ) {
     1761                if ( func_num_args() == 2 ) {
     1762                        $_wp_post_type_features[ $post_type ][ $feature ] = true;
     1763                } else {
     1764                        $_wp_post_type_features[ $post_type ][ $feature ] = array_slice( func_get_args(), 2 );
     1765                }       
    17661766        }
    17671767}
    17681768
    function add_post_type_support( $post_type, $feature ) { 
    17731773 *
    17741774 * @global array $_wp_post_type_features
    17751775 *
    1776  * @param string $post_type The post type for which to remove the feature.
    1777  * @param string $feature   The feature being removed.
     1776 * @param string       $post_type The post type for which to remove the feature.
     1777 * @param string|array $features  The feature being removed, accepts an array of
     1778 *                                feature strings or a single string.
    17781779 */
    1779 function remove_post_type_support( $post_type, $feature ) {
     1780function remove_post_type_support( $post_type, $features ) {
    17801781        global $_wp_post_type_features;
    17811782
    1782         unset( $_wp_post_type_features[ $post_type ][ $feature ] );
     1783        foreach ( (array) $features as $feature ) {
     1784                if ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ) {
     1785                        unset( $_wp_post_type_features[ $post_type ][ $feature ] );
     1786                }
     1787        }
    17831788}
    17841789
    17851790/**