How to import Theme Unit Test on localhost

Your XML file includes the following instructions.

  1. Log in to that site as an administrator.
  2. Go to Tools: Import in the WordPress admin panel.
  3. Install the “WordPress” importer from the list.*
  4. Activate & Run Importer.
  5. Upload this file using the form provided on that page.
  6. You will first be asked to map the authors in this export file to users on the site. For each author, you may choose to map to an existing user on the site or to create a new user.
  7. WordPress will then import each of the posts, pages, comments, categories, etc. contained in this file into your site.

*Step 3: Manual install

If you do not want to provide FTP credentials to WordPress for step 3 you can manually install the WordPress Importer plugin on your local machine following these steps.

  1. Download the WordPress Importer plugin to your computer.
  2. Unzip the plugin file.
  3. Copy the folder called “wordpress-importer” to your site’s /wp-content/plugins/ directory.
  4. Activate the plugin on the Plugins page.

You should now be able to use Tools->Import->Wordpress to import your XML file.

Additional info

When WordPress asks for FTP credentials it’s usually because of a server configuration that is preventing access to the files.

If you know your FTP credentials and do not want to enter them every time you install a plugin you can add them permanently to wp-config.php as constants. The specifics are here in the WordPress Codex.

In brief, you can use these constants, being sure to substitute the example credentials for your own FTP credentials, to avoid entering them every time.

define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org:21' );