[wp-trac] [WordPress Trac] #4622: Importing Blogger Post Slugs

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 12 12:17:36 GMT 2007

#4622: Importing Blogger Post Slugs
 Reporter:  clazh           |       Owner:  anonymous                  
     Type:  defect          |      Status:  new                        
 Priority:  normal          |   Milestone:  2.3 (trunk)                
Component:  Administration  |     Version:  2.3                        
 Severity:  normal          |    Keywords:  Blogger, Import, Post Slugs
 Hi there,
          Recently a friend wanted to move from blogger to wordpress but he
 was afraid to do it since after importing Wordpress auto generates the
 post slugs hence the permalinks change. I hunted around and found a
 solution. It involves adding just 2 lines of code in the blogger importer.
 I have blogged about it [http://www.clazh.com/move-from-blogger-to-
 wordpress-and-maintain-permalinks-and-traffic/   here]

 at around line 520. Insert these 2 lines after the call to wp_insert_post;

 preg_match("/([^\/]+)\.html$/", $entry->old_permalink ,$matches);
 $wpdb->query("UPDATE $wpdb->posts SET post_name = '" . $matches[1] . "'
 WHERE ID = '$post_id'");

Ticket URL: <http://trac.wordpress.org/ticket/4622>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list