customize_changeset_save_data

Filters the settings' data that will be persisted into the changeset.

Description

apply_filters( 'customize_changeset_save_data', (array) $data, (array) $filter_context ); 

Plugins may amend additional data (such as additional meta for settings) into the changeset with this filter.

Parameters (2)

0. $data — Optional. (array)
Updated changeset data, mapping setting IDs to arrays containing a $value item and optionally other metadata.
1. $filter_context (array)

Usage

To run the hook, copy the example below.
  1. $data = apply_filters( 'customize_changeset_save_data', $data, $filter_context ); 
  2.  
  3. if ( !empty( $data ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the customize_changeset_save_data callback 
  2. function filter_customize_changeset_save_data( $data, $filter_context ) { 
  3. // make filter magic happen here... 
  4. return $data
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'customize_changeset_save_data', 'filter_customize_changeset_save_data', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'customize_changeset_save_data', 'filter_customize_changeset_save_data', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-wp-customize-manager.php  
  1. $data = apply_filters( 'customize_changeset_save_data', $data, $filter_context );