If you have a large WordPress Extended RSS import file, WordPress suggests that you split the file in order to create multiple smaller files. If you do this, then each file will have the same authors. If you import the second file, third, fourth, etc… then those authors will be seen as duplicates and dropped (and all imported posts will be credited to ‘admin’) unless you go through each author and select them in the “or assign this post to existing author” combo boxes. These combo boxes become available after you select a file and press “Import.”
If you are importing multiple files because a single one is too big, there is a chance you could have way too many authors to go through each one and do this. This post describes a hack method of populating all of these combo boxes using jQuery and the browsers development tools.
I had to import 6 WXR files that i created, each one around 80Megs, and a total of almost 500 authors.
1) Get jQueryify here and add the bookmarklet per the instructions.
2) When you get to the “assign authors” page, right-click on the browser page and select “Inspect Element” (Chrome), or “Inspect with Firebug” in Firefox (install firebug if you haven’t already). In IE press F12 to start the Dev Tools.
3) Press the jQuerify bookmarklet button that you installed from step 1. This will turn on jQuery for the page.
4) Go to the console tab, enable the console if you need to, paste this code in and press RUN:
jQuery.noConflict(); //Disable jQuery $ just incase.
jQuery('#authors li').each(function() {
// Get the author login text
var username = jQuery(this).find('strong').html();
var author_login = jQuery.trim((username.split('('))[0]);
//Figure out which option this author is in the drop down.
var selectOptionval = -1;
jQuery(this).find('select option').each(function(){
if (jQuery(this).html() === author_login) {
selectOptionval = jQuery(this).val();
return false;//quit .each() early.
}
});
// Set the combo box to this author's option key.
jQuery(this).find('select').val(selectOptionval);
// For test...
//console.log(author_login + ": " + selectOptionval);
});
March 23rd, 2012 at 9:53 am
[…] original post here: Fixing authors when importing a split WXR file for WordPress Posts Related to Fixing authors when importing a split WXR file for WordPressFixing Alt – […]
May 8th, 2012 at 5:57 pm
Just had a go of this script on a small file (I too am going to have to import 500+ authors) and it worked. If all files appear as this, you Sir, will have gained super hero status. Will update again shortly.
May 8th, 2012 at 7:02 pm
Awesome… it should work. I just did it a couple weeks ago. If you hand out super hero status, do you mind doing it at mpickell.com? I’m moving over to that so i can host my own and have a little more flexibility with the blog.
August 24th, 2014 at 10:34 pm
This seems to work. The trouble I have is each time we do a import it does the “assign authors” thing and we have 3247 users it has to load. I think I am best trying to move the data via mySQL??
Any advice?
Cory
August 27th, 2014 at 1:37 pm
How often do you import? it sounds like you do it more than once… I only had to do this import once while converting from an old blog system to wordpress, so the manual process i describe above wasn’t too bad and did not need to be repeated.
Are you able to change your export process to split your data into multiple import files in a way that breaks it up by users? So for each import you only get maybe 500 authors?
Do you have access to the database or is it somewhere on a server that you only hit via this upload process?
I think I need more information on what the issues is that you are having with the 3247 users in order to give you more suggestions.
August 27th, 2014 at 1:48 pm
The issue was the browser trying to load 3247 “assign author” names. If fails and we do not want to have to manually select 3247 authors.
I ended up using SQL. Thanks