Changeset 47727
- Timestamp:
- 04/30/2020 12:03:11 PM (3 days ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r47617 r47727 158 158 } 159 159 160 if ( get_query_var( 'page' ) && $wp_query->post && 161 false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) { 160 if ( get_query_var( 'page' ) && $wp_query->post ) { 162 161 $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); 163 162 $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); -
trunk/src/wp-includes/class-wp.php
r47550 r47727 679 679 // Check for paged content that exceeds the max number of pages. 680 680 $next = '<!--nextpage-->'; 681 if ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $this->query_vars['page'] ) ) { 682 $page = trim( $this->query_vars['page'], '/' ); 683 $success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 ); 681 if ( $p && ! empty( $this->query_vars['page'] ) ) { 682 // Check if content is actually intended to be paged. 683 if ( false !== strpos( $p->post_content, $next ) ) { 684 $page = trim( $this->query_vars['page'], '/' ); 685 $success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 ); 686 } else { 687 $success = false; 688 } 684 689 } 685 690 } -
trunk/tests/phpunit/tests/canonical.php
r47122 r47727 176 176 array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ), 177 177 178 array( '/2008/03/03/comment-test/3/', '/2008/03/03/comment-test/' ), 179 array( '/2008/03/03/comment-test/?page=3', '/2008/03/03/comment-test/' ), 180 178 181 // Comments. 179 182 array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ), -
trunk/tests/phpunit/tests/link/wpGetCanonicalURL.php
r46586 r47727 12 12 self::$post_id = $factory->post->create( 13 13 array( 14 'post_status' => 'publish', 14 'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3', 15 'post_status' => 'publish', 15 16 ) 16 17 );
Note: See TracChangeset
for help on using the changeset viewer.