Skip to content

Instantly share code, notes, and snippets.

@balbuf
Created January 4, 2019 21:09
Show Gist options
  • Save balbuf/4665a0d9af9125895b3e01c20c13aaf8 to your computer and use it in GitHub Desktop.
Save balbuf/4665a0d9af9125895b3e01c20c13aaf8 to your computer and use it in GitHub Desktop.
Automatically populate "Assign Authors" drop downs during WordPress import
/**
Run this snippet in the JS console on the "Assign Authors"
step when running a WordPress import to automatically select
the author from the drop down that matches corresponding
author name shown from the incoming import data.
*/
$=jQuery;
$('#authors > li').each(function () {
$(this).find(`select option:contains('${$(this).find('> strong').text().replace(/^(.*) \(.+\)$/, '$1')}')`)
.prop('selected', true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment