From 436597a470d1fc786e571bc0ca531fd3da06e6e6 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Thu, 11 Jul 2019 11:12:30 +0200
Subject: [PATCH] Simplify & modernize author_can()

---
 src/wp-includes/capabilities.php | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
index 44f3debf20..6c8f76906b 100644
--- a/src/wp-includes/capabilities.php
+++ b/src/wp-includes/capabilities.php
@@ -719,7 +719,7 @@ function current_user_can_for_blog( $blog_id, $capability, ...$args ) {
  * @param mixed       ...$args    Optional further parameters, typically starting with an object ID.
  * @return bool Whether the post author has the given capability.
  */
-function author_can( $post, $capability ) {
+function author_can( $post, $capability, ...$args ) {
 	$post = get_post( $post );
 	if ( ! $post ) {
 		return false;
@@ -731,10 +731,7 @@ function author_can( $post, $capability ) {
 		return false;
 	}
 
-	$args = array_slice( func_get_args(), 2 );
-	$args = array_merge( array( $capability ), $args );
-
-	return call_user_func_array( array( $author, 'has_cap' ), $args );
+	return $author->has_cap( $capability, ...$args );
 }
 
 /**
-- 
2.21.0.windows.1

