Wordpress在加载时忽略分页符

I tried this question over at wordpress support and got no response. I have a page that has page breaks within it (<!-- nextpage -->) to split the content into multiple pages. I'm looking to remove the page breaks before load when certain sources hit the page, ideally using PHP. My thought process was that i could use the query string

http://example.com/post/?source=example

as an indicator for whether the page breaks will be there or not. But my question is whether it's actually possible to remove the page breaks that late? Considering the DOM is already loading when the php is executing but it hasn't reached the content, i'd assume not but i'd love to get the feature in.

Chris

First get the query var. use wp_link_pages() as a conditional function in the page. It will be executed only if you have (or may be don't have) certain query var in the url

add_action( 'the_post', function( $post )
{
    if (false !== strpos( $post->post_content, '<!--nextpage-->')) 
    {
        // Reset the global $pages:
        $GLOBALS['pages'] = [$post->post_content];

        // Reset the global $numpages:
        $GLOBALS['numpages']  = 0;

        // Reset the global $multipage:
        $GLOBALS['multipage'] = false;
    }
}, 99 );

Esta acción verificar en el contenido de cada articulo si existe <!--nextpage--> y establece las variables globales de WordPress como un articulo NO MULTIPAGE