[wp-hackers] Modifying wp-comments-post.php to accept new custom fields

Peter Westwood peter.westwood at ftwr.co.uk
Wed Sep 24 07:41:40 GMT 2008

DD32 wrote:
> Sorry, Seems that filter will be useless, as wp_insert_comment() 
> completely ignores any extra fields which you pass it, So you -will- 
> need to modify core files and add the item to the compact() in 
> wp_insert_comment() too (line 700ish of wp-includes/comment.php)
Yeah it does. :-(

But then it would have to magically guess the field names.

It looks like we need an action in wp_insert_comment which passes the ID 
of the new comment and the $commentdata to the action handlers so they 
can do things based on that - like add extra info to the database.

That way you can collect and process the data on pre_process_comment and 
insert it on the new action hook.

How does that sound?


Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5 

More information about the wp-hackers mailing list