get_previous_comments_link()
Gets the link (A tag) to the previous comments page. Should be used on the post page.
To get the link to the next comments page, use get_next_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_previous_comments_link( $label );
- $label(string)
- Text of the link
Default: '' (← Previous comments)
Examples
#1 Get a link to the previous comments page the current post
Let's say the post has 44 comments, and we are on the second page of comments, then:
$prev_link = get_previous_comments_link(); /* $link will be equal to <a href="http://example.com/foo/comment-page-1#comments">← Previous Comments</a> */
Changelog
| Since 2.7.1 | Introduced. |
| Since 6.7.0 | Added the page parameter. |