wpxdm

  • Services
    • WordPress Maintenance Troubleshooting and Support
    • Recent Work
  • About
  • Contact
  • Blog

Axure 8 Tutorial: How to Make Tabs

March 8, 2017 by Eric Gauvin Leave a Comment

Filed Under: Uncategorized

Axure 8 Tutorial: Quick and Easy Show and Hide Content with Link Text Change

March 8, 2017 by Eric Gauvin Leave a Comment

Filed Under: Uncategorized

How to add and remove WordPress theme unit test data with WP-CLI Aliases on Vagrant

January 19, 2017 by Eric Gauvin Leave a Comment

This post was inspired by:

http://www.kirstencassidy.com/installing-theme-unit-test-data-wp-cli/

Warning: These instructions include importing, exporting and resetting (deleting) your WordPress database. If you have any important data, you should make a backup first before trying this. Proceed at your own risk. I am not responsible for any loss of data.

Let’s say you’re working on a WordPress site/theme in your development environment and you’ve set up some plugins and then you want to import the theme unit test data and work on your theme. When you’re done working on your theme, you want to remove all the theme unit test data and keep all your plugin settings and any other pages you made before you imported the test data. You can do this easily with WP-CLI. In this example I will show you how to do it using WP-CLI aliases.

This assumes you’re somewhat comfortable with the command line and you’re using Vagrant and you know how to ssh into your Vagrant server and navigate around the folders and find the folder that has your WordPress site.

Here’s the basic concept. First you will export your database as a backup that you will use later to restore (“removing” the theme unit test data). Then, you will download the theme unit test data xml file onto your remote Vagrant server. After that, you can use WP-CLI to install and activate the WordPress Importer plugin and activate it. Once that’s installed you can import the xml file. After you’ve done that, you will see all the test data posts and pages in your WordPress site. When you’re finished developing your theme, you can remove all the theme unit test data by importing your backup and your plugin settings etc. will be preserved.

Although I’m doing this with WP-CLI aliases, you can do it without, but I think aliases make it a lot easier. Make sure you have WP-CLI install on your host system and your remote Vagrant server.

Here’s the info on how to set up aliases:

http://wp-cli.org/commands/cli/alias/

It may take a little experimentation to get it working.

Now you’re ready to begin.

Step 1

Make a backup of your database. You will use this later to restore and remove all the them unit test data.

(I’ve named my development alias “development”)

wp @development db export mydatabase.sql

(You can name your sql filename anything you want.)

Step 2

Use cURL (curl) to download the theme-unit-test-data.xml file from WordPress onto your Vagrant server into a specifc folder.

ssh vagrant@yourdomainname.test 'cd ../../path/to/wordpress && { curl -O https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml ; cd -; }'

Step 3

Install and activate the WordPress Import plugin.

wp @development plugin install wordpress-importer --activate

Step 4

Import theme-unit-test-data.xml.

wp @development import ./theme-unit-test-data.xml --authors=create

Now you should be able to go to your WordPress development site and see all the test posts and pages.

Step 5

After you’re finished developing your theme, you can remove all the theme unit test dat by resetting the database and importing the database backup from step 1.

wp @development db reset --yes
wp @development db import mydatabase.sql

Filed Under: Uncategorized

Search

Newsletter

Subscribe to my mailing list for all the latest news updates.

* indicates required

Recent Posts

  • Understanding Time Zones in The Events Calendar by Modern Tribe
  • How to Create an Event Flag in The Events Calendar by Modern Tribe
  • Review: Optitek Computer Readers by Select-A-Vision

About Me

Hi. I love designing and building websites with WordPress. I have many years experience working on websites for large corporations, and I'd like to use my skills and experience to bring your website idea to life. Read More…

Location

I'm nestled in the heart of New England's quaint Farmington Valley.

Expient LLC
71 Brookmoor Road, Avon CT, 06001

Start a Project

I'd love to hear about your upcoming project. Tell me about it by filling out my contact form.

Or, give me a call at 860-335-6082.

Connect

  • Dribbble
  • Email
  • Facebook
  • GitHub
  • Google+
  • LinkedIn
  • Pinterest
  • Tumblr
  • Twitter

Copyright © 2025 Expient LLC | Expient® is a registered trademark of Expient LLC.

Copyright © 2025 · Agency Pro Theme for expient on Genesis Framework · WordPress · Log in

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT