-$popular_importers = array();
-if ( current_user_can('install_plugins') )
- $popular_importers = array(
- 'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ),
- 'wpcat2tag' => array(__('Categories and Tags Converter'), __('Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.'), 'install', 'wp-cat2tag' ),
- 'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ),
- 'movabletype' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install', 'mt' ),
- 'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ),
- 'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ),
- 'tumblr' => array( __('Tumblr'), __('Install the Tumblr importer to import posts & media from Tumblr using their API.'), 'install' ),
- 'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' )
- );
-
-if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) {
- wp_redirect( admin_url('import.php?import=' . $popular_importers[$_GET['invalid']][3]) );
- exit;
+if ( current_user_can( 'install_plugins' ) )
+ $popular_importers = wp_get_popular_importers();
+else
+ $popular_importers = array();
+
+// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
+if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
+ $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
+ if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
+ wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
+ exit;
+ }
+ unset( $importer_id );