Ticket #11694: 11694.2.diff
File 11694.2.diff, 2.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/canonical.php
148 148 } 149 149 } 150 150 151 if ( get_query_var( 'page' ) && $wp_query->post && 152 false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) { 153 $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); 154 $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); 155 $redirect_url = get_permalink( $wp_query->post->ID ); 156 } 157 151 158 } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) { 152 159 // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101 153 160 if ( is_attachment() && ! $redirect_url ) { -
src/wp-includes/class-wp-rewrite.php
1072 1072 $sub2 .= '?$'; 1073 1073 1074 1074 //post pagination, e.g. <permalink>/2/ 1075 $match = $match . ' (/[0-9]+)?/?$';1075 $match = $match . '/?([0-9]+)?/?$'; 1076 1076 $query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1); 1077 1077 } else { //not matching a permalink so this is a lot simpler 1078 1078 //close the match and finalise the query -
src/wp-includes/class-wp.php
587 587 * @global WP_Query $wp_query 588 588 */ 589 589 public function handle_404() { 590 global $wp_query ;590 global $wp_query, $wp; 591 591 592 592 // If we've already issued a 404, bail. 593 593 if ( is_404() ) … … 596 596 // Never 404 for the admin, robots, or if we found posts. 597 597 if ( is_admin() || is_robots() || $wp_query->posts ) { 598 598 599 $success = true; 599 600 // Only set X-Pingback for single posts. 600 601 if ( is_singular() ) { 601 602 $p = clone $wp_query->post; … … 602 603 if ( $p && pings_open( $p ) ) { 603 604 @header( 'X-Pingback: ' . get_bloginfo( 'pingback_url' ) ); 604 605 } 606 607 // check for paged content that exceeds the max number of pages 608 $next = '<!--nextpage-->'; 609 if ( $p && false !== strpos( $p->post_content, $next ) && 610 ! empty( $wp->query_vars['page'] ) && 611 (int) $wp->query_vars['page'] > ( substr_count( $p->post_content, $next ) + 1 ) ) { 612 $success = false; 613 } 605 614 } 606 615 607 status_header( 200 ); 608 return; 616 if ( $success ) { 617 status_header( 200 ); 618 return; 619 } 609 620 } 610 621 611 622 // We will 404 for paged queries, as no posts were found.