WordPress 7.1 changes when wp_new_comment_notify_postauthor() checks a comment’s approval status: the check now happens before the notify_post_author filter is applied, rather than after. As a result, the filter receives an accurate default value, and its return value fully determines whether a notification is sent. See #64217. Previous behavior The filter received a default derived only from the comments_notify option (or the wp_notes_notify option for notes). The […]
WordPress 7.1 changes when wp_new_comment_notify_postauthor() checks a comment’s approval status: the check now happens before the notify_post_author filter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. is applied, rather than after. As a result, the filter receives an accurate default value, and its return value fully determines whether a notification is sent. See #64217.
The filter received a default derived only from the comments_notify option (or the wp_notes_notify option for notes). The comment’s approval status was checked after the filter ran, which had two consequences:
true for unapproved comments whenever the option was enabled, even though no notification would be sent.true from the filter could not force a notification for an unapproved comment – the return value was silently discarded.The approval status is now incorporated into the default value passed to the filter, and the filter’s return value is final:
false for comments that are not approved, including those held in moderation, marked as spam, or trashed.comments_notify option, and the default for notes continues to follow the wp_notes_notify option regardless of approval status.true from the filter now sends the notification, even for an unapproved comment.Two smaller changes ship alongside this:
'1') could be passed through, so callbacks that strictly compare the incoming $maybe_notify value should compare against true/false.false immediately without applying the filter. Previously, the filter still fired in this case.Sites or plugins using a callback such as __return_true on notify_post_author to force notifications will now also receive emails for comments held in moderation, marked as spam, or trashed. If that is not desired, the callback should check the comment’s approval status:
add_filter(
'notify_post_author',
function ( $maybe_notify, $comment_id ) {
$comment = get_comment( $comment_id );
// Only force notifications for approved comments.
if ( $comment && '1' === $comment->comment_approved ) {
return true;
}
return $maybe_notify;
},
10,
2
);
Callbacks that only suppress notifications (returning false) are unaffected, as are sites that do not filter notify_post_author at all.
Props to @milana_cap for peer review.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Accessibility Improvements in WordPress 7.1 | 0 | 9.59 | 13-08-2026 |
| 2 | A unified public exposure flag for Abilities in WordPress 7.1 | 0 | 10.01 | 04-08-2026 |
| 3 | Iframed Editor Changes in WordPress 7.1 | 0 | 10.99 | 03-08-2026 |
| 4 | WordPress 7.1 Field Guide | 0 | 18.06 | 05-08-2026 |
| 5 | WordPress 7.1 Release Candidate Phase | 0 | 11.72 | 05-08-2026 |
| 6 | WordPress 7.1 Release Candidate 3 | 0 | 13.06 | 12-08-2026 |
| 7 | Responsive block styles and configurable viewports in WordPress 7.1 | 0 | 8.27 | 05-08-2026 |
| 8 | WordPress 7.2 Call for Volunteers | 0 | 9.64 | 12-08-2026 |
| 9 | What’s new in Gutenberg 23.7? (05 August) | 0 | 11.85 | 06-08-2026 |
| 10 | Dev Chat Agenda – August 11, 2026 | 0 | 9.2 | 11-08-2026 |