Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

1 Answer

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( '/' ) )
    )
        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>';
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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