Skip to content

Instantly share code, notes, and snippets.

@joeyblake
Created February 20, 2015 21:32
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 joeyblake/519673dec628784f689e to your computer and use it in GitHub Desktop.
Save joeyblake/519673dec628784f689e to your computer and use it in GitHub Desktop.
Mapping Multiple authors on a WordPress data import browser snippet
jQuery('select[name*="user_map"]').each(function(idx, el){
var $select = jQuery(el),
$parent = jQuery(el).parent().parent(),
$strong = $parent.find('strong'),
name = $strong.text().split(' (')[0].trim(),
val = $select.find('option').filter(function () { return jQuery(this).html() == name; }).val();
if ( val !== undefined ) {
$select.val(val);
} else {
$parent.css('background', '#ffcc33');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment