If you mean, the last 5 comments on anything:
$comments = get_comments( array( 'count' => 5 ) );
foreach( $comments as $comment ) {
echo get_comment_link( $comment );
}
For a specific post or page comments, just change the $comments line to:
$comments = get_comments( array( 'post_id' => 1, 'count' => 5 ) ); // where the value of post_id is the ID of whatever post or page you want to retrieve comments from
Related Posts:
- Add option to disable comments on a per posts basis?
- Paginate result set from $wpdb->get_results()
- Change Comment Author Display Name
- What should I do to make generated avatars different for anonymous comments?
- Check If comment author is registered
- Success message in comment form
- How to allow the reply link to remain on the comment form after I have reached my 10 nested comment limit?
- Threaded comments – deleting parent comment leads to orphan comments
- Is there a hook for comment author link?
- How can I edit the email sent when a new comment is received?
- How to remove or replace the log-in link for comment replies?
- How to Block Access to Standard Login Flow and Comment Flow
- Add Comment Custom Field
- Remove link preview in discussion dashboard
- Upload images with comment
- Prevent Contributor to show comment list
- where to modify get_comment_author_link()?
- Does Akismet plugin expose any hooks, functions, class that can work with custom code?
- Comments Feed & Custom Post Statuses
- Multiple Comment Forms in a single page [closed]
- WordPress comment count to include attachment comments
- Displaying comments with a walker: how to distinguish between parent and child comments
- Count parent comments & replies separately?
- How to modify comments form using comment_form()?
- Capability for allowing user to post own comments without moderation
- Comment form problem with comment_author_url and HTML5 input placeholders
- How would I count the number of times a comment meta field’s value is in a post’s entire comments?
- stackexchange-like submit comment window
- Cannot get local avatars to show [closed]
- Limit user to one comment
- Is comment metadata included in the export file?
- Get a List of All Commenters on the Current Post
- WordPress comments on users profile
- wordpress threaded comments – customize nested ul / how child ul is displayd
- How to make a secure blog that is completely private?
- identify and delete spam comments from 3000 pending comments
- Hide comments column in WordPress backend
- Removing the limit on the number of nested comments
- How unrequire comment text in wordpress post
- Auto delete comment if Contains
- How would I add the comment count to this sub-pages of current page snippet
- How can I test why the comment hook is not working?
- API Hook for After Commenting (for sharing on Facebook)
- How do i remove “Website” field from WordPress comments
- Can comments by a logged-in user be displayed at the top?
- Placed on + only date (not time)
- Loading Comments From a Class?
- WordPress comments work locally only?
- have_comments not true for logged out visitors?
- “Discussion” checkboxes unchecked by default on pages? [duplicate]
- How to disable or hide WordPress.com as a social media login option for Jetpack Comments [closed]
- Anonymize comments after one year
- Minimum allowed comment length only on a specific page
- How can I count only guests comments?
- How many members have made comments approved for an article?
- How to get a value from comment meta
- reCaptcha doesnt appear in comment (manual or plugin)
- Comment System showing different type of IP
- Pending Comments
- Only Allow post author and “Premium” Role user to comment
- Anonymous spam comments when only registered users can comment
- get only one last comment from each post
- Applying same style to all the comments on the page
- Customise Comment form
- Limit action in comment according to IP
- How to get recent comment link
- stumped on add_action hook to delete_comment – any ideas?
- Can I create a new comment type?
- Avoiding calls to theme-compat
- Allow tags between shortcode in comments
- How / where is the wp_query object created for RSS feeds?
- Delete/Spam Comment Button
- Who approved a comment, to show up in dashboard
- Cannot Remove Title Reply from Custom Comment Template for Signup Page
- comment just attachment .. reply just text … can I do that?
- I have an odd field with a purple background, mentioning HTML-codes to use while leaving comments
- No comment Section but still got a Comment
- How to prevent users/authors from seing IP/email of new commentators?
- Why are my threaded comments not quite working? [closed]
- $post->comment_status always returns ‘closed’
- Order comments in admin by custom date
- WordPress Comments – Divide by conversation like Medium.com
- How to replace anonymous comment form with a registration form on wordpress?
- How to get the 5 most recent comments and each comment 5 most recent replies (children)
- Redirect first time comments
- Posting XML in comment section
- How to check if post has previous_comments_link() and next_comments_link()
- comment files and s
- Comments – Ensure the correct field is highlighted for nested replies
- How to hold all comments for moderation, including author’s comments on own post
- Comment Blacklist
- Subscribe to a post’s comments without posting a comment yourself
- WordPress error when sending comment
- WordPress Page Template: Comment Filtering with Querystring
- comments are going to spam
- Why default comment fields don’t show up?
- How to enable truly anonymous posting in bbPress forums? [closed]
- comment awaiting moderation
- How do you fetch the authors email or IP from /comments? (REST API)
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]