How can I see all of a post’s comments on a single page as a reader, if pagination is enabled?

Just build a link that has some query args:

printf(
     '<a href="http://example.com/all-comments?pid=%s">All comments</a>'
    ,get_the_ID()
);

Then add a page with a a permalink of all-comments, so you have something to target.

There you attach a template like the following (just a base to work off):

<?php
/**
 * Template Name: All Comments
 */

// Abort if we got no `pid` query arg and redirect
if ( ! isset( get_query_arg( 'pid' ) ) )
{
    // We got no referer, so we don't know where to go: Send visitor to home
    if ( 
        ! isset ( $_SERVER["HTTP_REFERER"] )
        OR ! strstr( $_SERVER["HTTP_REFERER"], home_url( "https://wordpress.stackexchange.com/" ) )
    )
        exit( wp_redirect( home_url( "https://wordpress.stackexchange.com/" ) ) );

    exit( wp_redirect( $_SERVER["HTTP_REFERER"] ) );
}

// Do something with our comments.
// So far we just throw some debug output to get insights and see if it's working:
echo '<pre>'.var_export( get_comments( array( 'post_id' => get_query_arg( 'pid' ) ) ), true ).'</pre>';

Leave a Comment