The get_next_comments_link() WordPress PHP function retrieves the link to the next comments page.
Usage
get_next_comments_link( $label, $max_page );
Example:
echo get_next_comments_link( 'Next Comments', 3 );
This will output a link to the next comments page with the text “Next Comments” and a maximum of 3 pages.
Parameters
$label
(string) Optional: Label for the link text. Default: ”$max_page
(int) Optional: Max page. Default: 0
More information
See WordPress Developer Resources: get_next_comments_link
Examples
Display next comments link with default settings
This code will display the next comments link with default label and no maximum page limit.
echo get_next_comments_link();
Custom link text
This code will display the next comments link with custom link text “View More Comments”.
echo get_next_comments_link( 'View More Comments' );
Custom max pages
This code will display the next comments link with a maximum of 5 pages.
echo get_next_comments_link( '', 5 );
Custom link text and max pages
This code will display the next comments link with custom link text “See More Comments” and a maximum of 4 pages.
echo get_next_comments_link( 'See More Comments', 4 );
Conditionally display next comments link
This code will display the next comments link only if there are more comments pages.
if ( get_next_comments_link() ) { echo get_next_comments_link( 'Load More Comments', 2 ); }