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
- ASP.NET MVC controller actions that return JSON or partial html
- How to check if I am in admin-ajax.php?
- Ajax in a settings page (update_option is undefined)
- Use default value of wp_customizer in theme_mod output?
- admin-ajax.php vs Custom Page Template for Ajax Requests
- Is there a hook that fires before an ajax call?
- AJAX request from Chrome Extension to WordPress Website
- How to correctly load wordpress in a non WP script for AJAX request
- Changing the entire control choices using wp.customize with JavaScript
- Why is admin ajax reloading my page
- Why this plugin doesn’t work with media upload page?
- Get_theme_mod not retrieving value
- CPU usage: AJAX and Heartbeat API on admin pages
- Solve cors problem using rest api or ajax
- Can part of my WordPress website be headless?
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- Why would admin-ajax.php redirect to the home page for logged out users?
- Embedded Twitter feed won’t render nicely when loaded via Ajax
- Enqueue script dinamically
- Most performant way of fetching remote API data?
- Admin-ajax responds with 0 due to empty $_REQUEST
- Using ajax with wordpress
- Using foreach inside an ajax function
- Ajax Modal Flickers When Opened Multiple Times
- Ajax image upload with media_handle_upload and form.js
- Caching-Plugins and Ajax-Page-Parts
- Ajax loading duplicate post
- WordPress AJAX – how to return true or false in the callback function
- WordPress Ajax POST Error 403 admin-ajax.php
- How do I detect in which page ajax_query_attachments_args is loaded?
- Ajax post returning full html page as response
- Which allowed API hooks work to add wp_ajax action?
- Pass additional parameter with async upload
- Ajax store response json in variables
- Performance optimization of tree like structure
- WordPress search results with Ajax, get_post_type() not working
- How can I set cookies on both secure and non-secure origins at the same time?
- Variable Products Being Added to Cart with AJAX on Shop and Category Pages
- Is it secure to use admin-ajax.php in front?
- Best way to use ajax front-end?
- Pull GetOption() variable into jQuery dynamically created html
- merge wp rest api query to get posts per category does not work
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- Load more posts in the same category – Ajax + Timber
- Something strange with ajax
- admin-ajax.php returns 0 even when the post status code is 200 OK
- is there’s a way to get the next page content generated by page break block with ajax call?
- Merge PDF files from post custom fields(ACF) into one PDF file and respond back the created PDF file, WordPress(AJAX Request)
- REST public POST giving 403 forbidden nginx
- Passing value from select form with Ajax not working
- Sending email through Ajax without page refresh hangs on admin_ajax.php
- Is there a public ajax endpoint?
- Why Ajax Doesn’t Work?
- How can i do public ajax call?
- How to prevent multiple post with same meta value being created simultaneously in WordPress (with ajax)
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Can’t GET Variable from AJAX URL
- JS global variable doesn’t update
- 404 error custom post type rest api
- How to update cart total after AJAX success
- How to implement AJAX within a class storing shortcode atts as class variables
- Jquery wrap permalink in a data-attribute?
- (Frontend AJAX) get post data WITH image thumbnail?
- Load .php file into div using ajax
- AJAX Post from same domain to a wordpress page
- Add Ajax loaded posts to existing posts
- How return normal search result using wp_ajax action for wordpress
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- how reduce fetch/XHR response time
- wordpress ajax bad request 400