WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With comment pagination, Google doesn't index the older pages and comments become essentially lost to searches.

Is there a way to let search engines crawl paginated comments, perhaps by generating a sitemap file that includes all paginated comments?

share|improve this question
up vote 2 down vote accepted

The reason of why Google doesn't index paginated comments is because of an issue with the canonical URL in your header. You can learn more about the reason behind this in a comprehensive question that I posted earlier. There is an excellent solution posted there for paginated post pages.

Now, for Google to index comment pagination, bungeshea posted an answer for a while ago when he (by accident) solved this when actually aiming to fix indexing for post pagination.

Luckily, I saved that code:

function comment_rel_canonical() {

    if ( ! is_singular() )

    global $wp_the_query;

    if ( ! $id = $wp_the_query->get_queried_object_id() )

    $link = get_permalink( $id );

    if ( $page = get_query_var('cpage') )
        $link = get_comments_pagenum_link( $page );

    if ( $paged = get_query_var( 'paged' ) )
        $link = add_query_arg( 'paged', get_query_var( 'paged' ), $link );

    printf ( '<link rel="canonical" href="%s" />\n', $link );

remove_action( 'wp_head', 'rel_canonical' );
add_action( 'wp_head', 'comment_rel_canonical' );
share|improve this answer
You can always link to a single state of a post. – toscho Apr 11 '13 at 5:39

Your Answer


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.