Question

veux juste changer un petit e-mail de l'auteur bit message de notification (wp_notify_postauthor - pluggable.php), et je suis l'application de filtres sur comment_notification_text

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

add_filter('comment_notification_text', 'myfunction');

Comment les données d'accès commentaire $, $ après, ... à myfunction?

Était-ce utile?

La solution

$ comment_id peut être passé comme second paramètre à votre fonction.

Modifier vous add_filter:

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

Ensuite, obtenir $ commentaire et $ après de $ comment_id:

function myfunction( $notify_message, $comment_id ) {
    $comment = get_comment( $comment_id );
    $post    = get_post($comment->comment_post_ID);
Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top