WordPress.org

Make WordPress Core

Ticket #14077: 14077.8.diff

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

    diff --git a/wp-includes/post-functions.php b/wp-includes/post-functions.php
    index fdd01ee..f0ce991 100644
    a b function _add_post_type_submenus() { 
    14241424 * count will show on the edit screen.
    14251425 *
    14261426 * @since 3.0.0
     1427 * @since 4.4.0 The `$feature` parameter was renamed to `$features`.
    14271428 *
    14281429 * @global array $_wp_post_type_features
    14291430 *
    14301431 * @param string       $post_type The post type for which to add the feature.
    1431  * @param string|array $feature   The feature being added, accepts an array of
     1432 * @param string|array $features  The feature being added, accepts an array of
    14321433 *                                feature strings or a single string.
    14331434 */
    1434 function add_post_type_support( $post_type, $feature ) {
     1435function add_post_type_support( $post_type, $features ) {
    14351436        global $_wp_post_type_features;
    14361437
    1437         $features = (array) $feature;
    1438         foreach ($features as $feature) {
    1439                 if ( func_num_args() == 2 )
    1440                         $_wp_post_type_features[$post_type][$feature] = true;
    1441                 else
    1442                         $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
     1438        foreach ( (array) $features as $feature ) {
     1439                if ( func_num_args() == 2 ) {
     1440                        $_wp_post_type_features[ $post_type ][ $feature ] = true;
     1441                } else {
     1442                        $_wp_post_type_features[ $post_type ][ $feature ] = array_slice( func_get_args(), 2 );
     1443                }
    14431444        }
    14441445}
    14451446
    function add_post_type_support( $post_type, $feature ) { 
    14471448 * Remove support for a feature from a post type.
    14481449 *
    14491450 * @since 3.0.0
     1451 * @since 4.4.0 The `$feature` parameter was renamed to `$features` and changed to
     1452 *              also accept an array of feature strings.
    14501453 *
    14511454 * @global array $_wp_post_type_features
    14521455 *
    1453  * @param string $post_type The post type for which to remove the feature.
    1454  * @param string $feature   The feature being removed.
     1456 * @param string       $post_type The post type for which to remove the feature.
     1457 * @param string|array $features  The feature being removed, accepts an array of
     1458 *                                feature strings or a single string.
    14551459 */
    1456 function remove_post_type_support( $post_type, $feature ) {
     1460function remove_post_type_support( $post_type, $features ) {
    14571461        global $_wp_post_type_features;
    14581462
    1459         unset( $_wp_post_type_features[ $post_type ][ $feature ] );
     1463        foreach ( (array) $features as $feature ) {
     1464                if ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ) {
     1465                        unset( $_wp_post_type_features[ $post_type ][ $feature ] );
     1466                }       
     1467        }
    14601468}
    14611469
    14621470/**