doAction( “close_area” )

doAction( "close_area", area, closeType );
doAction( "close_area_{key}", area, closeType );

Fired internally to trigger a stoppable close-request. If the request is not stopped, it ends in calling DiviArea.hide().

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


area DiviAreaItem|null, required
The Divi Area that should be hidden.
A null-value instructs the plugin to close the top-most Area, which is identical to calling DiviArea.hide() without a parameter.
closeType string, required
The event that caused the close_area action. It can be one of the following values:


// Output a console message when an Area should be closed.
DiviArea.addAction( 'close_area', function( area, closeType ) {
    if ( area ) {
        var key = area.getKey();
        console.log( 'The area', key, 'is about to be closed. Reason:', closeType );
    } else {
        console.log( 'The top-most area is closed. Reason:', closeType );


Possible close-types can be:

The user clicked the default close button of the Area.
The user clicked a custom close button inside the Area.
The user pressed the escape key (only for Popups).
The user clicked the background overlay (only for Popups).

The close_area action can be stopped by reacting to the ignore_close_area filter.

If you want to hide an Area, it is easier to call DiviArea.hide(area). The action is used internally by the JS API to allow other scripts to intercept and cancel the close request.

Was this article helpful?

Related Articles

Need Support?

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