[wp-hackers] wp_new_comment($commentdata) ignores timestamp?

John Eckman eckman.john at gmail.com
Wed Jul 7 17:57:55 UTC 2010

Working on a revision to my wpbook plugin that, among other things, imports comments from excerpts posted on FB walls. 

As a result, I end up inside a cron-called function, with an array of comment data to insert. 

If I go directly to wp_insert_comment($data) everything is kosher, but I'm bypassing other filters that might want to act on comment content, no notifications to the blog author (new comment posted!) fires, etc - basically I sneak the comment into the DB but that feels wrong. 

If I use wp_new_comment($data), it ignores the timestamp I'm setting. (The timestamp of "now" in the sense of when cron is running may not be the right timestamp for the post, which may have been yesterday). 

Is there a way to use wp_new_comment() but force it to accept a timestamp if one is passed in?

I suppose I could also just call wp_filter_comment() and then wp_insert_comment() so that at least filters get run - but will that cause notifications to fire?

John Eckman
eckman.john at gmail.com

More information about the wp-hackers mailing list