Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Change template of WordPress comment-page

For comment pages, the WP_Query-var cpage is set, telling us which comment page we’re on, making it is possible to filter the content for comment pages like this:

add_filter('the_content', 'comment_page_hide_content');
function comment_page_hide_content($content) {
    global $wp_query;
    if ($wp_query->get('cpage') > 1){ // Greater than one, because 1 inducates the first comment page
        $content = "";
    }
    return $content;
}

Related Posts:

  1. Aggregate comments, with pagination
  2. Reverse comment pagination numbers
  3. How can I see all of a post’s comments on a single page as a reader, if pagination is enabled?
  4. Set noindex page-comment from Pages 2, 3 and More?
  5. Customizing comments pagination for bootstrap
  6. Comment Pagination Behavior wp_list_comments() – comment ordering and pagination
  7. return paginate_comments_links() as array
  8. paginate_comments_links() not working
  9. How to Show Next-Previous Link Only
  10. Sort post comments from newest to oldest in pagination
  11. Paginated Comments “reply” does not work!
  12. Comments page id wp_list_comments
  13. How to check if post has previous_comments_link() and next_comments_link()
  14. pagination custom post type on CP page
Categories paginate-comments-links Tags paginate-comments-links
How to create a radio button to alt between settings in wp_options table
search for single meta_key with numeric array of meta values

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress