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 ?
1 Answer
$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);