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

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.


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


The filtered lifespan in minutes (integer)


// 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)

Was this article helpful?

Related Articles

Need Support?

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