Import WordPress Theme Unit Test Data by WP CLI

WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.

WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin.

When building a site, it is important to test as many edge cases as possible. Theme Unit Test Data is the way to go here and a minimum requirement for any professionally built WordPress theme (in my opinion anyway) If building a theme for the wordpress.org theme repository this will almost certainly be tested. For those using WP-CLI, there is a quick and easy way to install and then remove this test data.

Naturally, you will need to install and setup WP-CLI before proceeding.

Go to the terminal and follow those commands.

Activate the WP Importer plugin.

wp plugin install wordpress-importer --activate

Make sure you have installed “wget” otherwise, install it.

For mac, install by Terminal

 brew install wget

For the Linux (Ubuntu/CentOS)

sudo apt-get install wget
or
Yum install wget

Now download the theme unit test data XML file

wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml

Import!

wp import themeunittestdata.wordpress.xml --authors=create

It’ll take 1-5 minutes to depend on your internet speed.

Enjoy

Leave a Reply