Title: Automatically matching users in wordpress posts import
Last modified: August 19, 2016

---

# Automatically matching users in wordpress posts import

 *  [bepresents](https://wordpress.org/support/users/bepresents/)
 * (@bepresents)
 * [16 years ago](https://wordpress.org/support/topic/automatically-matching-users-in-wordpress-posts-import/)
 * 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.

 * 0 replies
 * 1 participant
 * Last reply from: [bepresents](https://wordpress.org/support/users/bepresents/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/automatically-matching-users-in-wordpress-posts-import/)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
