Import WordPress Theme Unit Test Data by WP CLI

Import WordPress Theme Unit Test Data by WP CLI 1

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

By Murshid Alam

Organizer of Barishal WordPress Meetup, WordPress Enthusiastic and, Open Source Lover. Over the last few years, I learned web programming and worked with them locally. I also assist in designing, developing and testing websites too!Before coming to web programming I was mostly involved with Electric Media(Channel i), Newspaper (Priyo, Bhorer Kagoj) and volunteering activities (including NGOs).I love to contribute to the WordPress Community. I am always happy to meet new peoples in the WordPress community and see how I can help them achieve their goals. When I am not online and WordPress, I love to play football, travel, riding the bike and attend Meetup/WordCamps!If you’d like, you can help me to attend WordCamps around the World.

Leave a Reply