From 6fb5ef65c0c6eaaea026b3f0b45a1e8028dbbcf4 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 11 Sep 2013 17:17:11 +0000 Subject: [PATCH] Avoid a notice by casting `$args['rewrite']` to `array()` before adding a `slug` property and running `array_merge()`. Fixes #23668. Built from https://develop.svn.wordpress.org/trunk@25351 git-svn-id: http://core.svn.wordpress.org/trunk@25313 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index fe30c82fa7..fe2bee4430 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -352,13 +352,17 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { } if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { + if ( ! is_array( $args['rewrite'] ) ) + $args['rewrite'] = array(); + if ( empty( $args['rewrite']['slug'] ) ) $args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy ); - $args['rewrite'] = wp_parse_args( $args['rewrite'], array( + + $args['rewrite'] = array_merge( array( 'with_front' => true, 'hierarchical' => false, 'ep_mask' => EP_NONE, - ) ); + ), $args['rewrite'] ); if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) $tag = '(.+?)';