I used get_comment()
but its parameter is $comment_ID
which I has to enter manually for previous comments from wp_comments
instead of that I need to get current comment means last updated comment author name based on the post_ID
. However wp_posts
and wp_comments
are related with post_ID
and comment_post_ID
, so I can use SQL query to get comment_ID I tried $wpdb->get_results('select comment_ID from wp_comments where comment_post_ID = 1')
its even manual process but at-least I want to pass comment_ID by fetching from database but could't do that query results nothing so is there any way to get current comment_ID for a post_ID I can get post_id by $post->ID
.
How to get comment_ID by post_ID in wordpress
Jeevan
- 13
- 1
- 5