rafsuntaskin
6/18/2015 - 5:34 AM

Get last comment for a wordpress post

Get last comment for a wordpress post

$PostID =  215;

global $wpdb;

$p = $wpdb->prefix;

var_dump($wpdb->get_results($wpdb->prepare("SELECT comment_date FROM {$wpdb->prefix}comments WHERE comment_post_ID = %d ORDER BY comment_date DESC LIMIT 1",$PostID)));