get_next_comments_link()
Gets a link (A tag) to the next comments page. Should be used on the post page.
To get a link to the previous comments page, use get_previous_comments_link()
1 time — 0.00019 sec (fast) | 50000 times — 2.7 sec (fast)
Hooks from the function
Returns
String|null. If the link exists, it will return the HTML code of the link (A tag).
Usage
get_next_comments_link( $label, $max_page );
- $label(string)
- Anchor of the link.
Default: '' ("Next comments →") - $max_page(int)
- Total number of comments pagination pages.
Default: 0 (value get_comment_pages_count())
Examples
#1 Get a link to the current post comments next page
Let's say the post has 44 comments, and we are on page two of the comments, then:
$link = get_next_comments_link(); /* $link will be equal to <a href="http://example.com/foo/comment-page-3#comments">Next comments →</a> */
Notes
- Global. WP_Query. $wp_query WordPress Query object.
Changelog
| Since 2.7.1 | Introduced. |
| Since 6.7.0 | Added the page parameter. |