diff --git a/sites/all/modules/wordpress_migrate/wordpress_migrate.pages.inc b/sites/all/modules/wordpress_migrate/wordpress_migrate.pages.inc
index a013a84..7fded0b 100644
--- a/sites/all/modules/wordpress_migrate/wordpress_migrate.pages.inc
+++ b/sites/all/modules/wordpress_migrate/wordpress_migrate.pages.inc
@@ -224,7 +224,7 @@ function wordpress_migrate_import_form_submit($form, &$form_state) {
 
     // Fix unencoded ampersands
     $wxr_string = str_replace('&amp;', '&', $wxr_string);
-    $wxr_string = str_replace('&', '&amp;', $wxr_string);
+    $wxr_string = preg_replace('/&(?![a-zA-Z0-9=# ]+;)/', '&amp;', $wxr_string);
     file_put_contents($destination, $wxr_string);
     try {
       $blog = wordpress_migrate_blog($destination);
