false ) ); if ( is_array( $categories ) && $categories !== array() ) { foreach ( $categories as $category ) { $category_nicename = $category->slug; if ( $category->parent == $category->cat_ID ) { // Recursive recursion. $category->parent = 0; } elseif ( $taxonomy->rewrite['hierarchical'] != 0 && $category->parent != 0 ) { $parents = get_category_parents( $category->parent, false, '/', true ); if ( ! is_wp_error( $parents ) ) { $category_nicename = $parents . $category_nicename; } unset( $parents ); } $category_rewrite[ $blog_prefix . '(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]'; $category_rewrite[ $blog_prefix . '(' . $category_nicename . ')/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$' ] = 'index.php?category_name=$matches[1]&paged=$matches[2]'; $category_rewrite[ $blog_prefix . '(' . $category_nicename . ')/?$' ] = 'index.php?category_name=$matches[1]'; } unset( $categories, $category, $category_nicename ); } // Redirect support from Old Category Base. $old_base = $wp_rewrite->get_category_permastruct(); $old_base = str_replace( '%category%', '(.+)', $old_base ); $old_base = trim( $old_base, '/' ); $category_rewrite[ $old_base . '$' ] = 'index.php?wpseo_category_redirect=$matches[1]'; return $category_rewrite; } } /* End of class */