diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 30d1bd91bf..fad223ee4a 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -1021,10 +1021,17 @@ nonce: api.settings.nonce, query: function() { + var dirtyCustomized = {}; + api.each( function ( value, key ) { + if ( value._dirty ) { + dirtyCustomized[ key ] = value(); + } + } ); + return { wp_customize: 'on', theme: api.settings.theme.stylesheet, - customized: JSON.stringify( api.get() ), + customized: JSON.stringify( dirtyCustomized ), nonce: this.nonce.preview }; }, @@ -1067,6 +1074,10 @@ return; } + // Clear setting dirty states + api.each( function ( value ) { + value._dirty = false; + } ); api.trigger( 'saved' ); } ); }; diff --git a/src/wp-includes/js/customize-base.js b/src/wp-includes/js/customize-base.js index 6c41b40c43..765c59505d 100644 --- a/src/wp-includes/js/customize-base.js +++ b/src/wp-includes/js/customize-base.js @@ -158,6 +158,7 @@ window.wp = window.wp || {}; initialize: function( initial, options ) { this._value = initial; // @todo: potentially change this to a this.set() call. this.callbacks = $.Callbacks(); + this._dirty = false; $.extend( this, options || {} ); @@ -187,6 +188,7 @@ window.wp = window.wp || {}; return this; this._value = to; + this._dirty = true; this.callbacks.fireWith( this, [ to, from ] );