Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: customize_save_response

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1098           $invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) );
1099           $exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
1100           if ( $invalid_setting_count > 0 ) {
1101                $response = array(
1102                     'setting_validities' => $exported_setting_validities,
1103                     'message' => sprintf( _n( 'There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ),
1104                );
1105
1106                /** This filter is documented in wp-includes/class-wp-customize-manager.php */
1107                $response = apply_filters( 'customize_save_response', $response, $this );
1108                wp_send_json_error( $response );
1109           }
1110
1111           // Do we have to switch themes?
1112           if ( ! $this->is_theme_active() ) {
1113                // Temporarily stop previewing the theme to allow switch_themes()
1114                // to operate properly.
1115                $this->stop_previewing_theme();
1116                switch_theme( $this->get_stylesheet() );
 
Line Code
1150            *
1151            * This filter does not apply if there was a nonce or authentication failure.
1152            *
1153            * @since 4.2.0
1154            *
1155            * @param array                $data Additional information passed back to the 'saved'
1156            *                                   event on `wp.customize`.
1157            * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1158            */
1159           $response = apply_filters( 'customize_save_response', $data, $this );
1160           wp_send_json_success( $response );
1161      }
1162
1163      /**
1164       * Refresh nonces for the current preview.
1165       *
1166       * @since 4.2.0
1167       */
1168      public function refresh_nonces() {