Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.