Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp notify postauthor


This function is responsible for sending comment notification emails to the post author whenever a reader leaves a comment. It is pluggable and can be customized using plugins.

This function is pluggable using the following filters:

  • comment_notification_text
  • comment_notification_subject
  • comment_notification_headers

If the plugins do not redefine the functions using filters, then the default functionality will be used.

To modify the content of the email that is sent when a reader leaves a comment, you may provide filters for each of the above functions in your plugin.

This function also sanitizes a URL for use in a redirect.


<?php wp_notify_postauthor$comment_id ?>


(integer) (required) Comment ID
Default: None
(string) (optional) Deprecated in Version 3.8 and should no longer be used. The comment type either 'comment' (default), 'trackback', or 'pingback'
Default: ''

Return Values

False if user email does not exist. True on completion.



  • This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
  • Uses: apply_filters() Calls 'allowed_redirect_hosts' on an array containing WordPress host string and $location host string.

Change Log

  • 3.8.0: The comment $comment_type parameter was deprecated. See ticket #17862.
  • Since: 1.0.0

Source File

wp_notify_postauthor() is located in wp-includes/pluggable.php.


See also index of Function Reference and index of Template Tags.