WordPress.org

Make WordPress Core

Ticket #47678: 47678-map_meta_cap-part-2.patch

File 47678-map_meta_cap-part-2.patch, 1022 bytes (added by jrf, 12 months ago)

Use spread operator in map_meta_cap() [2]

  • src/wp-includes/capabilities.php

    From 1497c955790eaa3eaa905146e0a63f0f287823eb Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 18 Jul 2019 08:09:50 +0200
    Subject: [PATCH] Use spread operator in map_meta_cap() [2]
    
    ---
     src/wp-includes/capabilities.php | 3 +--
     1 file changed, 1 insertion(+), 2 deletions(-)
    
    diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
    index e2d132d217..7965ed8e8d 100644
    a b function map_meta_cap( $cap, $user_id, ...$args ) { 
    582582                        // Handle meta capabilities for custom post types.
    583583                        global $post_type_meta_caps;
    584584                        if ( isset( $post_type_meta_caps[ $cap ] ) ) {
    585                                 $args = array_merge( array( $post_type_meta_caps[ $cap ], $user_id ), $args );
    586                                 return call_user_func_array( 'map_meta_cap', $args );
     585                                return map_meta_cap( $post_type_meta_caps[ $cap ], $user_id, ...$args );
    587586                        }
    588587
    589588                        // Block capabilities map to their post equivalent.