Last active
October 16, 2020 18:46
-
-
Save johnalarcon/b8711588676c5d6c026b599485b92985 to your computer and use it in GitHub Desktop.
Hook in to the ClassicPress widget update process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ajaxSuccess(function(e, xhr, settings) { | |
// This is the data of interest. | |
console.log(settings); | |
// Identifier for your (or whatever) particular widget. | |
var widget_id_base = 'text'; // text, search, my-widget, et al. | |
// Check if updating a widget of this type. | |
if((settings.data.search('action=save-widget') != -1) && (settings.data.search('id_base='+widget_id_base) != -1)) { | |
// The data from the widget. | |
console.log(settings.data); | |
// Do amazing things here. | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment