applyFilters( "set_data_expire" )

applyFilters( "set_data_expire", lifespan, key, value );
applyFilters( "set_data_expire_{key}", lifespan, key, value );

Filters the lifespan of a local data entry. This will directly influence the Cookie expiration date or the internal expiration timestamp of localStorage entries.

The dynamic part of the filter name is the sanitized entry name. See DiviArea.Utils.sanitizeHookName() for details.


(int, required) The lifespan of the item, in minutes.
(string, required) Name of the entry. This will be part of the Cookie name or the localStorage object key.
(string, required) The value which will be saved to the Cookie or localStorage.


// Disable local data
DiviArea.addFilter( 'set_data_expire', function( lifespan, key, value ) {
    return 0;


The DiviArea.Utils.setLocalData() method will decide, whether to write a Cookie or to save data to the localStorage instead.

When this filter returns a value lower than 1, then no entry is saved in the localStorage (and no Cookie will be created)

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.