Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/canonical.php

    r15463 r15708  
    104104            if ( $redirect_url = get_permalink(get_query_var('p')) )
    105105                $redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']);
    106             if ( get_query_var( 'page' ) ) {
    107                 $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
    108                 $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
    109             }
    110106        } elseif ( is_single() && !empty($_GET['name'])  && ! $redirect_url ) {
    111107            if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) )
     
    181177            }
    182178        } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
    183             $category = get_term_by('slug', get_query_var('category_name'), 'category');
     179            $category = get_category_by_path(get_query_var('category_name'));
    184180            $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids'));
    185181            if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) )
    186182                $redirect_url = get_permalink($wp_query->get_queried_object_id());
     183        }
     184
     185        // Post Paging
     186        if ( is_singular() && get_query_var('page') && $redirect_url ) {
     187            $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
     188            $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
    187189        }
    188190
Note: See TracChangeset for help on using the changeset viewer.