Background Processing filter
Regardless of the setting in Dashboard you can enable or disable background processing for a particular Trigger with a simple filter. You can reference default Triggers here.
Disable Triggers
Enable Triggers
add_filter( 'notification/trigger/process_in_background', function( $enabled, $trigger ) {
$disabled_trigger_slugs = [
'user/registered',
'user/login',
];
​
if ( in_array( $trigger->get_slug(), $disabled_trigger_slugs, true ) ) {
return false;
}
​
return $enabled;
}, 10, 2 );
add_filter( 'notification/trigger/process_in_background', function( $enabled, $trigger ) {
$enabled_trigger_slugs = [
'user/registered',
'user/login',
];
​
if ( in_array( $trigger->get_slug(), $enabled_trigger_slugs, true ) ) {
return true;
}
​
return $enabled;
}, 10, 2 );
This filter was added in version 7.2.3.
Copy link