applyFilters( “ignore_close_area” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Filters
  6. applyFilters( “ignore_close_area” )
DiviArea.applyFilters( 'ignore_close_area', ignore, area, closeType );
DiviArea.applyFilters( 'ignore_close_area_{id}', ignore, area, closeType );

Allows to ignore the close_area request and force an area to stay open.

The {id} part in the hook name is the sanitized area-ID (all lower case, dashes changed to underscores).


(bool) Whether to ignore the close_area command and keep the area visible. Default: false.
(DiviAreaItem) The Divi Area which will be hidden.
(string) Identifies the event, that triggered the close_area call.


// Remember the timestamp when the Area was made visible.
DiviArea.addAction( 'show_area', function( area ) {
    area.setData( 'opened_at', new Date().getTime() );

// Forces every Area to stay visible for at least 10 seconds.
DiviArea.addFilter( 'ignore_close_area', function( ignore, area, closeType ) {
    var openSince = (new Date().getTime() - area.getData( 'opened_at' )) / 1000;

    if ( openSince >= 10 ) {
        return false; // process the close-request.
    } else {
        console.log('Try again in', parseInt(10 - openSince), 'seconds');
        return true; // ignore the close-request.


This filter is applied after any close_area action was fired.

However,DiviArea.hide() will always hide the Area without calling the ignore_close_area filter!

Was this article helpful?

Related Articles