- if ( ! empty( $current_url ) )
- $parsed_url = @parse_url( $current_url );
-
- // Attempt to redirect bare category slugs if the permalink structure starts
- // with the %category% tag.
- if ( isset( $parsed_url['path'] )
- && preg_match( '#^[^%]+%category%#', $wp_rewrite->permalink_structure )
- && $cat = get_category_by_path( $parsed_url['path'] )
- ) {
- if ( ! is_wp_error( $cat ) )
- return get_term_link( $cat );
- }
-