Support » Plugin: WordPress Importer » [Plugin: WordPress Importer] bug: Author problem importing multiple WXR files

  • Resolved mpickell


    Sorry if this ends up a repeat in the forum… i posted there and now i’m trying to register a bug on the plugin itself.. hope that’s where this goes.

    i’m using wordpress-importer version 0.5.2 according to the plugins page in wordpress.

    I’m following the suggestions on this page and splitting a very large WXR import file into smaller pieces in order to load it into a new WordPress site.

    I have turned on WP_DEBUG (ie, set to true) in wp-config.php using define('WP_DEBUG',true); so that i can see what is happening during the import.

    When i import the first file, all of my authors are correctly listed with the corresponding posts. But when i import the next file , the authors on all of the posts are set to “admin”. During the import i get an error something like “not adding author XXX, already exists.” which is fine, except that this seems to also block linking from that author to the posts.

    Any help here? The instructions say i can do this but this seems like an author-import bug on the multiple file importing.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Maybe this line:

    $user_id = wp_insert_user( $user_data );

    in the get_author_mapping() function of the plugin is returning an error and therefore defaulting (in the following lines) to admin?

    If that’s the case, then this “insert user” call should be returning the existing user, or maybe a retry on this call with the author’s ‘user_pass’ field blanked out since it is randomly generated each time and will never match an existing user?

    Just throwing something out there. i’ll add more debug lines to the plugin tonight and try to see where it is failing.

    or a problem with the import file having an older user id and the new wordpress blog having already given that user a new id?

    Plugin Author Jon Cave


    WordPress Dev

    Are you using the “or assign posts to an existing user” dropdown on the “Assign Authors” page for the 2nd, 3rd, … import(s) to map the users to those imported by the first file?

    no, i have 470 users… would i have to do that in order to get this result?

    that might be a nice “fill all” checkbox…

    I think i may be able to go back using firebug and auto-select all of those if that is necessary… but is that the best way?

    On that “Assign Authors” page, option 1 is “import this username” suggests to me that i’m importing that same user… it’s a little confusing

    Is it possible to get something i could throw in the author_select() function of the plugin as a temp fix to select the “or assign posts to…” option and have its selection match the $author['author_login'] or $author['author_display_name'] name (whichever is needed… mine are the same)?

    Here’s a hack solution that fit my need. With almost 500 users i couldn’t select all of these by hand.

    I wrote it up on my blog so i could put better description in it

    –REMOVED– I fixed the last comment so i removed this comment.

    Here’s the summary…

    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.
    // For test…
    //console.log(author_login + “: ” + selectOptionval);

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: WordPress Importer] bug: Author problem importing multiple WXR files’ is closed to new replies.