Make WordPress Core


Ignore:
Timestamp:
11/07/2025 02:05:43 PM (5 months ago)
Author:
ellatrix
Message:

Notes: notify post author on note submission.

Fix an issue where new notes did not trigger a notification because they are submitted via the REST API. Ensures REST API submissions (for notes) trigger the post author notification. Leverage existing comment notification infrastructure.

Developed in https://github.com/WordPress/wordpress-develop/pull/10472.

Fixes #64204.
Props adamsilverstein, mamaduka, peterwilsoncc, ellatrix, wildworks, mukesh27, desrosj, annezazu, jeffpaul.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r61144 r61179  
    24262426function wp_new_comment_notify_postauthor( $comment_id ) {
    24272427    $comment = get_comment( $comment_id );
    2428 
    2429     $maybe_notify = get_option( 'comments_notify' );
     2428    $is_note = ( $comment && 'note' === $comment->comment_type );
     2429
     2430    $maybe_notify = $is_note ? get_option( 'wp_notes_notify' ) : get_option( 'comments_notify' );
    24302431
    24312432    /**
     
    24482449    }
    24492450
    2450     // Only send notifications for approved comments.
    2451     if ( ! isset( $comment->comment_approved ) || '1' !== $comment->comment_approved ) {
    2452         return false;
     2451    // Send notifications for approved comments and all notes.
     2452    if (
     2453        ! isset( $comment->comment_approved ) ||
     2454        ( '1' !== $comment->comment_approved && ! $is_note ) ) {
     2455            return false;
    24532456    }
    24542457
Note: See TracChangeset for help on using the changeset viewer.