Avoid getting tripped up on post content that starts with <!--nextpage-->. props SergeyBiryukov. fixes #16746.
git-svn-id: https://develop.svn.wordpress.org/trunk@24599 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
65bf560b9d
commit
8f24ab263d
@ -3656,12 +3656,15 @@ function setup_postdata( $post ) {
|
||||
if ( is_single() || is_page() || is_feed() )
|
||||
$more = 1;
|
||||
$content = $post->post_content;
|
||||
if ( strpos( $content, '<!--nextpage-->' ) ) {
|
||||
if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
|
||||
if ( $page > 1 )
|
||||
$more = 1;
|
||||
$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
|
||||
$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
|
||||
$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
|
||||
// Ignore nextpage at the beginning of the content.
|
||||
if ( 0 === strpos( $content, '<!--nextpage-->' ) )
|
||||
$content = substr( $content, 15 );
|
||||
$pages = explode('<!--nextpage-->', $content);
|
||||
$numpages = count($pages);
|
||||
if ( $numpages > 1 )
|
||||
|
Loading…
Reference in New Issue
Block a user