From 0df94bb337fe091dd67ea9f4f6889dba6519ba4c Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 29 Sep 2016 13:27:17 -0700 Subject: [PATCH] Include customized state in fetch-settings requests --- js/customize-posts.js | 1 + php/class-wp-customize-posts.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/js/customize-posts.js b/js/customize-posts.js index 119b272..09268f9 100644 --- a/js/customize-posts.js +++ b/js/customize-posts.js @@ -308,6 +308,7 @@ request = wp.ajax.post( 'customize-posts-fetch-settings', { 'customize-posts-nonce': api.settings.nonce['customize-posts'], 'wp_customize': 'on', + 'customized': api.previewer.query().customized, 'post_ids': newPostIds } ); diff --git a/php/class-wp-customize-posts.php b/php/class-wp-customize-posts.php index 8c18e7b..931aa4f 100644 --- a/php/class-wp-customize-posts.php +++ b/php/class-wp-customize-posts.php @@ -1322,10 +1322,13 @@ public function ajax_fetch_settings() { wp_send_json_error( 'bad_post_ids' ); } + $this->manager->add_dynamic_settings( array_keys( $this->manager->unsanitized_post_values() ) ); + $setting_params = array(); $settings = $this->get_settings( $post_ids ); foreach ( $settings as $setting ) { if ( $setting->check_capabilities() ) { + $setting->preview(); $setting_params[ $setting->id ] = $this->get_setting_params( $setting ); } }