WordPress.org

Make WordPress Core

Ticket #47678: 47678-add_post_type_support.patch

File 47678-add_post_type_support.patch, 1.2 KB (added by jrf, 12 months ago)

Simplify & modernize add_post_type_support()

  • src/wp-includes/post.php

    From 3801973cc307b92f316c1f7b08ee30c8cb38e3ab Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 11 Jul 2019 12:01:14 +0200
    Subject: [PATCH] Simplify & modernize add_post_type_support()
    
    ---
     src/wp-includes/post.php | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 0f76da8cb1..1c2ae8b040 100644
    a b function _add_post_type_submenus() { 
    17791779 *                                feature strings or a single string.
    17801780 * @param mixed        ...$args   Optional extra arguments to pass along with certain features.
    17811781 */
    1782 function add_post_type_support( $post_type, $feature ) {
     1782function add_post_type_support( $post_type, $feature, ...$args ) {
    17831783        global $_wp_post_type_features;
    17841784
    17851785        $features = (array) $feature;
    function add_post_type_support( $post_type, $feature ) { 
    17871787                if ( func_num_args() == 2 ) {
    17881788                        $_wp_post_type_features[ $post_type ][ $feature ] = true;
    17891789                } else {
    1790                         $_wp_post_type_features[ $post_type ][ $feature ] = array_slice( func_get_args(), 2 );
     1790                        $_wp_post_type_features[ $post_type ][ $feature ] = $args;
    17911791                }
    17921792        }
    17931793}