Skip to main content
Version: v9 (Current)

WordPress Notification Background Processing Control

WordPress notification background processing can be controlled on a per-trigger basis using filters, allowing developers to optimize performance by enabling or disabling asynchronous processing for specific notification triggers based on requirements and server capabilities.

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​

add_filter(
'notification/trigger/process_in_background',
function($enabled, $trigger) {
$disabledSlugs = [
'user/registered',
'user/login',
];

if (in_array($trigger->getSlug(), $disabledSlugs, true)) {
return false;
}

return $enabled;
},
10,
2
);

Enable Triggers​

add_filter(
'notification/trigger/process_in_background',
function($enabled, $trigger) {
$enabledSlugs = [
'user/registered',
'user/login',
];

if (in_array($trigger->getSlug(), $enabledSlugs, true)) {
return true;
}

return $enabled;
},
10,
2
);
warning

This filter was added in version 7.2.3.