[wp-trac] [WordPress Trac] #18064: Adding a hook for specific comment types

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 10 19:17:56 UTC 2011


#18064: Adding a hook for specific comment types
------------------------------------+-------------------------
 Reporter:  joostdevalk             |       Owner:
     Type:  enhancement             |      Status:  closed
 Priority:  normal                  |   Milestone:
Component:  Comments                |     Version:
 Severity:  minor                   |  Resolution:  worksforme
 Keywords:  has-patch dev-feedback  |
------------------------------------+-------------------------
Changes (by scribu):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 Instead of using get_comment(), you receive the comment object as the
 second argument:

 {{{
 function my_test_callback( $comment_id, $comment ) {
   if ( 'foo' == $comment->comment_type ) {
     // do stuff here
   }
 }
 add_action('wp_insert_comment', 'my_test_callback', 10, 2);
 }}}

 Therefore, there is really no need for an additional action there.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18064#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list