1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Filters
  6. applyFilters( “area_general_conditions” )

applyFilters( “area_general_conditions” )

applyFilters( "area_general_conditions", conditions, area );
applyFilters( "area_general_conditions_{key}", conditions, area );

Filter the condition promise, during area initialization. This filter is called once per Area, right after the page loaded.

The dynamic part of the filter name is the sanitized Area key. See DiviAreaItem.theKey() for details.

When all conditions are met, the trigger is initialized. When one condition fails, the trigger stays inactive for the current request.


conditions Promise, required
A promise that resolve()s when all conditions are met, or reject()s when a condition is not met.
area DiviAreaItem, required
The new area instance.


This filter must return a Promise!


// Randomly disable a trigger, with a 50% chance.
addAction("area_general_conditions", function(conditions, area) {
  function customCheck(resolve, reject) {
    if (Math.random() > 0.5) {
    } else {
      reject("Optional reject reason");

  conditions = conditions.then(() => new Promise(customCheck));

  return conditions;
// Call a remove URL via Ajax to see if the trigger should be initialized.
addAction("area_general_conditions", function(conditions, area) {
  function customAjaxCheck(resolve, reject) {
      .then(function(response) {
        return response.json()
      .then(function(json) {
        if (json.success) {
        } else {
          reject("Ajax check failed");

  conditions = conditions.then(() => new Promise(customAjaxCheck));

  return conditions;


No notes

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Get in touch with us