Filter hook 'customize_changeset_save_data'

in WP Core File wp-includes/class-wp-customize-manager.php at line 2904

View Source

customize_changeset_save_data

Filter Hook
Description
Filters the settings' data that will be persisted into the changeset. Plugins may amend additional data (such as additional meta for settings) into the changeset with this filter. }

Hook Information

File Location wp-includes/class-wp-customize-manager.php View on GitHub
Hook Type Filter
Line Number 2904

Hook Parameters

Type Name Description
array $data Updated changeset data, mapping setting IDs to arrays containing a $value item and optionally other metadata.
array $context { Filter context.

Usage Examples

Basic Usage
<?php
// Hook into customize_changeset_save_data
add_filter('customize_changeset_save_data', 'my_custom_filter', 10, 2);

function my_custom_filter($data, $context) {
    // Your custom filtering logic here
    return $data;
}

Source Code Context

wp-includes/class-wp-customize-manager.php:2904 - How this hook is used in WordPress core
<?php
2899  		 *     @type int|false            $post_id       Post ID for the changeset, or false if it doesn't exist yet.
2900  		 *     @type array                $previous_data Previous data contained in the changeset.
2901  		 *     @type WP_Customize_Manager $manager       Manager instance.
2902  		 * }
2903  		 */
2904  		$data = apply_filters( 'customize_changeset_save_data', $data, $filter_context );
2905  
2906  		// Switch theme if publishing changes now.
2907  		if ( 'publish' === $args['status'] && ! $this->is_theme_active() ) {
2908  			// Temporarily stop previewing the theme to allow switch_themes() to operate properly.
2909  			$this->stop_previewing_theme();

PHP Documentation

<?php
/**
		 * Filters the settings' data that will be persisted into the changeset.
		 *
		 * Plugins may amend additional data (such as additional meta for settings) into the changeset with this filter.
		 *
		 * @since 4.7.0
		 *
		 * @param array $data Updated changeset data, mapping setting IDs to arrays containing a $value item and optionally other metadata.
		 * @param array $context {
		 *     Filter context.
		 *
		 *     @type string               $uuid          Changeset UUID.
		 *     @type string               $title         Requested title for the changeset post.
		 *     @type string               $status        Requested status for the changeset post.
		 *     @type string               $date_gmt      Requested date for the changeset post in MySQL format and GMT timezone.
		 *     @type int|false            $post_id       Post ID for the changeset, or false if it doesn't exist yet.
		 *     @type array                $previous_data Previous data contained in the changeset.
		 *     @type WP_Customize_Manager $manager       Manager instance.
		 * }
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-customize-manager.php
Related Hooks

Related hooks will be displayed here in future updates.