我编写了一个函数来更新评论从未批准变为已批准时的评论时间:
function ji_update_comment_date($comment){
$commentarr = array(
\'comment_ID\'=>comment_ID(),
//this is where it fails me,I can\'t get the ID
\'comment_date\'=>date("Y-m-d H:i:s"),
\'comment_date_gmt\'=> date("Y-m-d H:i:s")
);
wp_update_comment( $commentarr );}
add_action(\'comment_unapproved_to_approved\',\'ji_update_comment_date\');
所以comment\\u ID()不起作用,我似乎无法得到它,否则我的代码工作得很好。