Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#19860 closed defect (bug) (invalid)

pre_comment_approved filter has second argument undefined

Reported by: laotse's profile laotse Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

I wrote a filter:

function tgb_comment_filter_approved($mApproved, $aCommentData){ ... }
add_filter('pre_comment_approved', 'tgb_comment_filter_approved');

and $aCommentData is always undefined. So effectively the changeset 15592 fixing #14802 does not work.

Change History (1)

#1 @dd32
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

You must specifically add the filter asking for 2 arguements to be passed.:

add_filter($action, $function, $priority=10, $number_of_args=1);

So you want:

add_filter('pre_comment_approved', 'tgb_comment_filter_approved', 10, 2);

Note: See TracTickets for help on using tickets.