From 075245d89446cc6245cb4d8097f1fb812de87b9e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 24 Sep 2015 19:38:11 +0000 Subject: [PATCH] Convert the `$args` passed to `register_post_type()` into an array before passing them to the new `register_post_type_args` filter. Fixes #17447 git-svn-id: https://develop.svn.wordpress.org/trunk@34513 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/post-functions.php b/src/wp-includes/post-functions.php index 0d89a0ea98..a9f1ffc665 100644 --- a/src/wp-includes/post-functions.php +++ b/src/wp-includes/post-functions.php @@ -992,14 +992,15 @@ function register_post_type( $post_type, $args = array() ) { // Sanitize post type name $post_type = sanitize_key( $post_type ); + $args = wp_parse_args( $args ); /** * Filter the arguments for registering a post type. * * @since 4.4.0 * - * @param array|string $args Array or string of arguments for registering a post type. - * @param string $post_type Post type key. + * @param array $args Array of arguments for registering a post type. + * @param string $post_type Post type key. */ $args = apply_filters( 'register_post_type_args', $args, $post_type ); @@ -1031,7 +1032,7 @@ function register_post_type( $post_type, $args = array() ) { '_builtin' => false, '_edit_link' => 'post.php?post=%d', ); - $args = wp_parse_args( $args, $defaults ); + $args = array_merge( $defaults, $args ); $args = (object) $args; $args->name = $post_type;