There is a bug in WordPress 4.8.2 which causes pending customized changes to not be injected into Ajax requests in the preview. This has been fixed in 4.9-alpha via #42162. In the mean time, however, you can do a workaround to modify the requested url with logic like:
// Workaround defect introduced in WordPress 4.8.2 where preview nonce is not included in request.
if ( 'undefined' !== typeof _wpCustomizeSettings ) {
urlParser = document.createElement( 'a' );
urlParser.href = url;
urlParser.search += '&customize_preview_nonce=" + _wpCustomizeSettings.nonce.preview;
url = urlParser.href;
}
Related Posts:
- get_option() vs get_theme_mod(): Why is one slower?
- SSL breaks customizer: page isn’t returned from ajax
- get_template_part execute with ajax
- Why does get_theme_mod return blank (or default value) but get_option returns saved value?
- Minimal WordPress load for only `get_option` to work (because ajax…)
- Problems with creating sortable sections in customizer
- Cannot update my options using wp_ajax
- How to localize inline script called with ajax
- Theme Customizer – Conditional Controls
- Edit a different page in WP Customizer
- Customizer AJAX using buttons
- Radio buttons live refresh in the customizer
- get_theme_mod only returns false
- update_option is not saving an array, but saving the string ‘Array’
- How to reuse get_template_part() containing a simple loop to work with AJAX correctly?
- Using get_theme_mod in php ajax form doesn’t work
- Can’t load search results with ajax
- update_option in WordPress AJAX
- How to perform a frontend HTTP call with AJAX when plugin save the new settings?
- How to load dynamic option with ajax
- WordPress Select Option Load Custom Fields
- Ajax and get_template_part
- AJAX save options inside class
- AJAX call in backend results in empty update_option
- Using AJAX for dynamic settings pages
- using Ajax: call to undefined function get_option
- get_template_part() does not render after the ajax request
- Access to a data from a response AJAX called in a template file php
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- JavaScript implementation of Gzip
- How to cache json with wp-super cache
- WordPress AJAX with Axios
- REST API endpoint for elasticpress autosuggest
- Admin Notification after save_post, when ajax saving in gutenberg
- Cannot load admin-ajax.php. No access-control allow origin*
- Initialize JS with an ajax loaded ACF form
- WordPress Nonce Issue for Ajax Login and Logout
- How to modify wp_ajax function?
- Nonces and Ajax request to REST API and verification
- possible to make sections in theme customizer sortable and saveable at publish button clicked?
- Vue.js + AJAX Shortcode
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
- wp_ajax action is not running
- get_theme_mod not working
- Ajax – gettext without a plugin
- How do I set the url to make an ajax request for a html document?
- wp-admin AJAX with Fetch API is done without user
- Ajax stops working when logged in?
- Is it safe to manually sign a user in using AJAX?
- My ajax code not returning ajax value
- register ajax calls hook
- Long Polling: Stuck in while loop
- Show Post Content with AJAX
- Using an if statement in the theme customizer page
- update_post_meta using ajax
- How to export custom database data to excel file
- How to update Comment post meta through an Ajax call
- POST Ajax bad request
- Ajax for subscibers not working
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- 200 return code on ‘POST /wp-admin/admin-ajax.php’ while NOT logged in
- i’m trying to get all my media query attachments via ajax in wordpress
- Distinguish between 2 instances of admin-ajax.php
- How to update post with Ajax (no plugin)
- Next Ajax call doesn’t work
- Ajax page load without reload
- need a confirmation text to appear on email submission
- Including ‘wp-load.php’ after another include() generates an error
- WordPress Ajax Page Load to skip embedded iframe
- edit user input data contact form 7
- Simple AJAX code that refreshes every x seconds?
- How to keep scripts persistent during admin-ajax process when saving widget?
- Very weird bug: Ajax for non-admins
- Search function – problem with whole words
- jQuery ajax method does not return data
- WordPress 403 error on form submission with Ajax
- Ajax is not defined
- Get posts by category via ajax
- Download doccument on server rather than clients browser
- Load oEmbed iframe within ajax call
- Adding pagination to Ajax Query
- WordPress 4.9.6 – IncludeMe & getAjax GET using wrong URL
- Create secondary Archive page format?
- Get post details with pure javascript ajax
- WorddPress website admin part not working correctly – I think ajax/json issue
- Ajax Security regarding user priviliges and nonces
- How to populate data from JSON using AJAX in TypeScript? [closed]
- Use ajax without a plugin?
- Weird admin-ajax.php problem
- Ajax contact form returnig 0
- Know which script/page is being called by ajax call
- Can’t update WP Editor after Ajax
- Posting to loop.php file
- Running js in html code with same content
- How to get current_user_id from wordpress in node js?
- AJAX call not initializing for non-admins in WordPress
- How to use Ajax with WordPress
- Using $.ajax getting 500 error
- WordPress Customizer add_control Dropdown of Pages with Multi Select?