Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you build a theme, it's important to test it against all the different types of content people can place in a WordPress site. Building all this content can take a long time, but fortunately, you don't actually have to do this. You can simply download what's known as the Theme Unit Test data for WordPress. This is a full set of content for a WordPress site that covers all the bases and provides all the weird scenarios you should test for. The Theme Unit Test data is available as an XML file.
You can download from codex.wordpress.org/Theme_Unit_Test. Here on this page, just scroll down, you see right here at the top, under Test Environment Setup, download test data. So here I'm going to save this link as, and I'll save it on my desktop, and once I have this downloaded I can use the WordPress importer to import the content from this XML data. Because the Theme Unit Test data is actually just a regular export from a WordPress site that someone set up specifically to do Theme Unit Testing.
So I'm going to go back to my WordPress site here, which is nice and styled with underscores now. I'll go to the backend, and here I'm going to go to tools and import, and select WordPress. And since this is the first time I'm running the WordPress importer, I now have to install the WordPress importer plugin, so I'll click install now. The plugin is installed and I'll activate it and run the importer, and now that I'm in the importer, I can go and navigate by choosing File, to my Desktop, and find the Theme Unit Test data file, and click Upload file and import.
Now the file is brought into WordPress, and I'm asked if I want to import the authors that are defined inside the Theme Unit Test, or if I want to assign all the posts to existing authors. So I'm going to leave all this blank and scroll to the bottom. And here, it's important that you check the Download and import file attachments so that you get all the images and other media that's assigned to different posts within this data. So when this is checked, click Submit, and WordPress will now import all the data from that file that we downloaded, and also bring in all the images and other media elements that are assigned to that data.
Once the Theme Unit Test data is installed, you'll see our site now has lots of new content. I'll open it here in a separate tab. At the very top, you see we now have a large menu here with multiple different items and there's even a drop-down menu here and another drop-down that has multiple levels. We have different posts with different types of content. And throughout the course I'll be referring to specific posts or pages that we can use to test specific scenarios. You'll see here we have a post that has HTML tags and formatting.
Scrolling down, we have a post that has images in different alignments and sizes and so on, and so on. Now that you've installed the Theme Unit Test data, I encourage you to go explore what content is currently on your site. Now, because you're using underscores it may be a bit frustrating to explore it from the front end. So you can also go to the back end of your site and go under posts, and check out all your posts. And here you see that the posts have very obvious names, like the scheduled post is scheduled but not public yet.
There's a draft post, there's a post with HTML tags, there's one with image alignment, text alignment. Some of them are sticky. Some of them have passwords on them. And when you go through you'll realize that this data pretty much covers every possible scenario someone can upload to your site. And that's why you want to install it. Now you have all the data you need to be able to make sure you're covering all your bases when you create your new theme. So take some time to browse through the new content on your site and see how it all displays.
That way, when you're working on something specific, like image alignment or password protection or commenting, you'll always know where to find the test data for that specific scenario.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Your file was successfully uploaded.