Skip to content

Instantly share code, notes, and snippets.

@BhargavBhandari90
Created December 20, 2018 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BhargavBhandari90/cc6943eda51fbffd458d239852d144b6 to your computer and use it in GitHub Desktop.
Save BhargavBhandari90/cc6943eda51fbffd458d239852d144b6 to your computer and use it in GitHub Desktop.
Assign Users while importing data in WP importer
(function($){
$('#authors li').each(function(key, value) {
var name = $(this).children('strong').first().html();
var re = /\s\([^\)]+\)/gi;
name = name.replace(re, '');
$(this).find('select').first().children('option').each(function(){
if ($(this).html() == name) {
console.log('Comparing ' + $(this).html() + ' to ' + name + ".\n");
$(this).attr('selected', 'selected');
}
});
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment