Disable auto-subscribing users for notifications

By default, we auto-subscribe you to a post (or any post type) to receive further notifications about the content. This will happen if you add an editorial comment or edit and save the content. Fortunately, there’s a way to change this up. First, though, read our introduction to extending Edit Flow.

If you want to block auto-subscription for all cases, simply add the following to functions.php in your theme:

// Do not auto-subscribe any user to receive notifications when saving a post or when adding an editorial comment
add_filter( 'ef_notification_auto_subscribe_current_user', '__return false' );

If, instead, you only want to turn off auto-subscription for leaving an editorial comment, you’d include the following:

/**
 * Do not auto-subscribe any user to receive notifications when adding an editorial comment.
 *
 * @param bool $auto_subscribe the default auto-subscription functionality
 * @param string $subscription_type the type of auto-subscription that might occur: 'comment' for adding an editorial comment or 'subscription_action' for saving a post
 * @return whether users should receive notifications when modifying a post
 */
function efx_dont_auto_subscribe_for_editorial_comments( $auto_subscribe, $subscription_type ) {
    // Do not auto-subscribe when adding an editorial comment
    if ( $subscription_type === 'comment' )
        return false;
    // Keep the default functionality in other cases
    return $auto_subscribe;
}
add_filter( 'ef_notification_auto_subscribe_current_user', 'efx_dont_auto_subscribe_for_editorial_comments', 10, 2 );

To instead turn off auto-subscription only when editing a post (rather than when posting an editorial comment), change the first line of code in the function to:

if ( $subscription_type === 'subscription_action' )
%d bloggers like this: