Skip to content

Instantly share code, notes, and snippets.

@tddewey
Created September 11, 2013 01:05
Show Gist options
  • Save tddewey/6518077 to your computer and use it in GitHub Desktop.
Save tddewey/6518077 to your computer and use it in GitHub Desktop.
In javascript, do something if the featured image (post thumbnail) is updated
// Do something if the featured image is updated by inspecting ajaxComplete callback
jQuery(document).ajaxComplete(function(event, xhr, settings){
// Parse the request
var vars = {};
var requestVars = settings.data.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
vars[key] = value;
});
// Take action if the action parameter is for the thumbnail
if ( vars.action === 'set-post-thumbnail') {
// Do something.
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment