How to change a comment's date?
-
Hi,
I am using wp_new_comment() to insert add a new comment to a post which works pretty well with the exception that the function ignores the ‘comment_date’ parameter that you send to it and just inserts the current date/timestamp.
I have tried calling wp_update_comment() after I get the new comment’s id back from wp_new_comment() but it’s just returning false. Can someone please let me know if I am calling wp_update_comment() incorrectly or if there is a better hook to use?
$date = date_parse($date); $commentarr = array(); $commentarr['comment_ID'] = $newcomment; $commentarr['comment_date'] = date("YYYY-MM-DD HH:MM:SS", strtotime($date)); $updatecomment = wp_update_comment( $commentarr ); // $updatcomment is false after the above function call.
- The topic ‘How to change a comment's date?’ is closed to new replies.