- $multipage = 1;
- $content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
- $content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
- $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
+ $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 );