Hook: mam_brevo_should_sync_user

Signature

$should = apply_filters( 'mam_brevo_should_sync_user', bool $should, int $user_id, string $context );
Parameter Type Description
$should bool Result of the Roles to sync setting. true when no roles are ticked.
$user_id int The WordPress user.
$context string Why the sync runs: signup, profile_update, role_change, manual, backfill, delete, or a context passed to mam_brevo_sync_user.

Return true to sync, false to skip.


Behaviour

  • Checked when the background job runs, with fresh user data, and when a user is deleted (delete), before the contact is removed or deleted in Brevo.
  • Returning false skips the user. It does not remove a contact that is already in Brevo.
  • Users without a valid email are always skipped.

Example

Keep staff and test accounts off the marketing list:

add_filter( 'mam_brevo_should_sync_user', function ( $should, $user_id, $context ) {
    $user = get_userdata( $user_id );
    if ( $user && str_ends_with( strtolower( $user->user_email ), '@example.com' ) ) {
        return false;
    }
    return $should;
}, 10, 3 );

  • MAM Brevo Email Manager Overview
  • Hook: mam_brevo_sync_user

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-brevo-email-manager
Applies to plugin version 26.41.1+
Category Extending MAM Suite
Hook type filter
Audience PHP developer
Last verified 2026-10-05
Was this article helpful?
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!