WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

just want to change a little bit author email notify message(wp_notify_postauthor - pluggable.php),and I'm applying filters on comment_notification_text

function myfunction(){
  return "<div class='left_side'>"..$comment..$post.."</div>"

add_filter('comment_notification_text', 'myfunction');

How to access data $comment,$post,... in myfunction ?

share|improve this question
up vote 2 down vote accepted

$comment_id can be passed as second parameter to your function.

Modify you add_filter:

add_filter('comment_notification_text', 'myfunction', 10, 2);

Then get $comment and $post from $comment_id:

function myfunction( $notify_message, $comment_id ) {
    $comment = get_comment( $comment_id );
    $post    = get_post($comment->comment_post_ID);
share|improve this answer
thank you,I think that I try that,but I didn't change add_filter to accept 2 arguments.Thanks for helping me. – user1147 Nov 10 '10 at 23:41
You are welcome – sorich87 Nov 11 '10 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.