applyFilters( “set_data” )

applyFilters( "set_data", value, key );
applyFilters( "set_data_{key}", value, key );

Filters a value that will be written to a Cookie or the localStorage.

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


The filtered value.


// Example 1: Output data to the console before it will be saved.
DiviArea.addFilter( 'set_data', function( value, key ) {
    console.log('Saving local variable', key, 'with value', value);
    return value;
// Example 2: Disable local data
DiviArea.addFilter( 'set_data', function( value, key ) {
    return false;


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

When this filter returns boolean false, then no entry is saved in the localStorage (and no Cookie will be changed)

Was this article helpful?

Related Articles

Need Support?

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