Creating Sample XML Data for Multiple WordPress Sites
Creating Sample XML Data for Multiple WordPress Sites
Bloggers working with several clients understand the difficulty in managing multiple installations of WordPress, especially when it comes to initial design and site testing. Clients always want to preview an early version of the site to test the look and feel, to make sure text looks good on the page, and to confirm the site has all the desired functionality.
But constantly populating those new sites with posts, pages, and comments can be a real chore; and for the developer, it doesn’t bring any measurable return. That’s why efficient designers don’t create new test content for each client. Instead, they make use of sample XML data to get even the newest WordPress installation up to speed quickly with template posts, pages, media, and admin settings. For admins running WordPress Multisite, sample content can be extremely powerful.
If you’re planning to work with clients creating and designing blogs, here are a few tips that will save you time populating those sites with sample content using WordPress’ built in import/export functionality.
Use WordPress Tools to Import and Export Content
In the TOOLS section of the WordPress admin dashboard you will see two options; Import and Export. For such a small menu item with no discernible settings, this WordPress functionality packs some power, and allows you to become the ninja designer you want to be.
Simply put, EXPORT allows you to take the current site’s posts and pages and export them to an xml file for use outside the blog. IMPORT allows you to import external posts and pages into the current site.
Creating an XML Export of Your WordPress Content
In the export settings menu WordPress gives you a short explanation of the XML format and what it can be used for. You’ll notice the built-in exporting feature allows you to make a copy of posts, pages, comments, custom fields, categories, and tags.
If you have custom post types those options will also be available to choose from downloads, and will show up underneath standard posts and pages.
In this screen, you can select whether you want certain types of content, like just posts, or just pages, or all content to be exported. When you’re done, simply click “Download Export File” and you will have a portable version of your blog’s data, which can then be imported into another WordPress installation, or any site that accepts XML data imports.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Importing an XML File to WordPress
Importing data in your WordPress back-end is just as easy as exporting. The first import menu screen shows you the different types of data you can import. You’ll notice WordPress’ standard importing features allow you to pull in data from eight of the most popular blogging platforms.
Since the data we exporting was directly from WordPress you’ll choose “WordPress.” If this is the first time you’ve used the WordPress Import feature, the system may ask you to install WordPress’s import functionality. That is actually done through a plugin. Simply follow the instructions on-screen and you will be taken directly to the import plugin for installation. Activate it, and navigate back to the WordPress Import Settings to bring in the XML data.
A file upload dialog box will prompt you to find the xml data. WordPress parses the data and strips out authors and images for further processing.
If the xml data includes content from multiple authors, WordPress will ask you to whom in your current blog those posts should be assigned. If the blog into which you are importing is new and only one author exists, all those posts will be attributed to that author.
If the imported content contains images and file attachments, WordPress will import those attachments attempt to place them in the posts and pages for you automatically, and import them into your media library as well. To perform that function, you’ll make sure the check box for “Download and import file attachments” is selected before clicking the Submit button to finish your import.
On the final import screen you’ll see a running list of imported data. If all goes well, you will get a message that all the data is imported correctly, and WordPress will tell you to “Have fun!”
If there were errors, WordPress will list them for you. Usually import errors occur when functionality from one blog doesn’t mix with the second blog. For instance, if you have custom post types setup in the export blog, but not in the imported blog, those posts might fail to upload correctly. Also, if you have categories setup in the first blog which do not yet exist in the second blog, you might see a fail error. It’s usually best to import into blogs which have roughly the same setup as the blog from which you exporting. That’s why creating sample xml template data is best done in the early stages of a blog, or for blogs which will be used as simple demo sites for your clients.
Using XML template files allows you to quickly take sample data from one blog to another blog, without having to constantly create content for new clients. Experienced WordPress developers use this method when designing new themes and showing them off or creating live demo’s for potential clients and theme purchasers.
If you use WordPress’ multisite configuration, you can also populate all your network sites with the same sample data, including pictures, media, and post content – making it even easier for your users to get up to speed with their new blogs.