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
This commit is contained in:
Scott Taylor 2013-09-11 17:17:11 +00:00
parent fc1fc39a89
commit 6fb5ef65c0
1 changed files with 6 additions and 2 deletions

View File

@ -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 = '(.+?)';