#18064 closed enhancement (worksforme)
Adding a hook for specific comment types
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Comments | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
Right now there's no way to hook an action only for specific comment types, resulting in the issue that each plugin that hooks in almost always need to do get_comment, because it need to get the comment type.
Attachments (1)
Change History (3)
#1
@
14 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
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.
Note: See
TracTickets for help on using
tickets.
Proposal patch