Installing WP Test Data with WP CLI

I’ve been using WP Test for a while for testing out my custom WordPress themes. I like how easy it is to load lots of content edge cases and make sure my theme doesn’t break. It cuts down on a lot of the time it takes to do QA on a custom theme.

Post Status has recently taken over the project. You can still download and install the data using the WordPress Importer, but they also have a WP CLI integration now. I’m trying to incorporate WP CLI into my workflow as much as I can, so I tried installing the test data using their install script.

Here’s how I did it. (Note: You must have WP CLI installed for this to work)

  1. Download their WP CLI install script from the github repo.
  2. Move this file to the root of all your WordPress installs. In my case that was cd ~/Sites
  3. From the terminal, cd in the directory where the file lives and run sh wptest-cli-install.sh
  4. When prompted, enter the path to the WordPress install where you want to install the data. Since you’re in the root of your sites directory, just enter the folder name of the site.

That’s it!

You only have to download the install script once. Now that you have it at the root of all your sites, you can run the command any time you need test data to work with.

Leave a Reply

%d bloggers like this: