Is there an URL I can access, or an argument that can be passed, to disable pagination on the reader's side?

The blog uses standard Wordpress comment pagination, i.e., http://example.com/2012/01/post-title/comment-page-1/

I'd like to be able to reformulate the URL into something like http://example.com/2012/01/post-title/all-comments

  • In general WP is intentionally engineered so that client cannot override pagination and quantity properties via manipulating URL (imagine someone requesting multiple thousands of posts and frying server). It would help if you also described what and why you want to achieve something like that so better (or maybe alternate) solutions can be offered.
    – Rarst
    Nov 17 '12 at 20:46

Just build a link that has some query args:

     '<a href="http://example.com/all-comments?pid=%s">All comments</a>'

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):

 * 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( '/' ) )
        exit( wp_redirect( home_url( '/' ) ) );

    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>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.