• We’re using comment pagination on our site and trying to optimize with SEO best practices by adding rel=”previous” and rel=”next” to the pagination of comments.

    I can create the rel=”previous” links, but when creating the rel=”next” links I need to check that it’s not exceeding the total # of comment pages (ex. if a post has 5 pages of comments and you are on page 5, we don’t want to create a rel=”next” link for page 6 as it doesn’t exist).

    The WordPress function to get the total # of comment pages is get_comment_pages_count(), but it looks inaccessible from our functions.php file since it can only get called inside of “The Loop” in WordPress.
    https://codex.wordpress.org/Function_Reference/get_comment_pages_count#Notes

    Any ideas on how to solve this issue?

  • The topic ‘Comment Pagination Help’ is closed to new replies.