• Hi,

    I thought I’d share a bit of code I wrote to update the WordPress Blog import feature to automatically pick a match to the blog posting’s author.

    in the file

    /wp-admin/import/wordpress.php

    at line 264 there is a for loop, replace with this :

    foreach ($users as $user) {
    
    			similar_text($user->display_name, $author, $percentage);
    
    			$percentage = floor($percentage);
    
    			if($percentage > 95)
    				$strSelected = ' selected="selected" ';
    			else
    				$strSelected = '';
    
    			echo '<option value="'.$user->user_id.'"'.$strSelected.'>'.$user->user_login." : ".$user->display_name." : ".$percentage.'</option>';
    		}

    That will automatically pick the user in the system that matches the author of the blog based upon the names. It will also print out a percentage of name matches, just in case your names are similar.

The topic ‘Automatically matching users in wordpress posts import’ is closed to new replies.