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
- Cannot get user’s ACF data when using a template part in a WP_User_Query
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- JavaScript implementation of Gzip
- jQuery: Performing synchronous AJAX requests
- ASP.NET MVC controller actions that return JSON or partial html
- jQuery’s .on() method combined with the submit event
- Ajax takes 10x as long as it should/could
- How to check if I am in admin-ajax.php?
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- How to cache json with wp-super cache
- Load minimum WordPress environment
- Why use wp_send_json() over echo json_encode()?
- Why use admin-ajax.php and how does it work?
- How to get a unique nonce for each Ajax request?
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Why not register shortcodes if is_admin dashboard?
- Using jQuery to delete data stored in wp_options
- WordPress AJAX with Axios
- Why is die() used at the end of function that handles an Ajax request?
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Making my AJAX powered WordPress Crawlable
- Is there a JavaScript API? How to access public and private data in JS?
- Get Previous & Next posts by Post ID
- failed to load wp-admin/admin-ajax.php
- Using Backbone with the WordPress AJAX API
- Using Ajax with a Class file
- Ajax in a settings page (update_option is undefined)
- How to pass data parameter to ajax action function handler
- WordPress Ajax Data Security
- Use default value of wp_customizer in theme_mod output?
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- Ajax and autocomplete
- How to add to cart via AJAX Woocommerce [closed]
- Nonces and Cache
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
- How to HTML5 FormData Ajax
- admin-ajax.php vs Custom Page Template for Ajax Requests
- How to override WP_DEBUG for Ajax responses?
- Stop admin-ajax?
- redirect out of wp-admin, without losing admin-ajax.php
- Call to undefined function add_action()
- Is it safe to assume that a nonce may be validated more than once?
- Including WordPress in RESTful API
- Is having multiple theme customizers for different pages possible?
- Multiple ajax nonce requests
- Can I create customizer setting that can handle plugin shortcode?
- Get posts with ajax
- admin-ajax.php doesn’t work when using POST data and Axios
- How to call a PHP function with Ajax when the user clicks a button
- REST API endpoint for elasticpress autosuggest
- Ajax for non-logged-in users
- Contact Form 7 Custom Post Action
- Custom Form with Ajax
- How to process ajax requests correctly using ajax plugins
- ajax – why multiple calls to wp_create_nonce() return same value?
- Update user meta using with ajax
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- WordPress function that makes HTML safe to be sent via AJAX request
- How do I hook an Ajax request into a PHP callback?