WordPress sure is great…
- Plugins
- Themes
- WYSIWYG Editing
The Rockstars of WordPress
The Roadies of WordPress
What is a Roadie?
An individual who is responsible for setting up, tearing down, and generally maintaining the equipment for a band.
Without roadies, the rockstars can't perform at different venues.
Without an export you're content is stuck!
How Content is Stored within WordPress
The Database
- Content (Post/Page Stuff, custom fields)
- Comments
- Terms and Relationships
- Options/Widgets/Settings
The Main Folders
wp-content Holds Your Stuff!
Inside of wp-content
- Uploads holds all of your uploaded files
Media are stored in the Uploads folder
But they are referenced by Posts stored in the database.
Why might I need Export/Import?
- Changing Web Hosts
- Moving from WordPress.com to your own WordPress site
- Set-up a staging or development version of your site
- Moving from some other CMS to WordPress
Where are the Export/Import features?
Under the Tools menu.
Exporting
Getting stuff out of WordPress.
The Export Screen
A WXR File Includes
- Posts, Pages, and Custom Post Types
- Comments
- Custom Fields
- Categories, Tags, and Custom Taxonomies
- Users
A WXR File Doesn't Include
- Your Uploaded Media Files*
- Most Options/Settings
- Widgets
How can we migrate those things not included in the WXR file?
Uploaded Media Files
- Download them on import
- Copy your wp-content/uploads folder
Downloading Media Files on Import
Handy when it works but unreliable.
Copying the Uploads Folder
- FTP into your server
- Navigate to /wp-content
- Download the Uploads folder to your computer
- Might as well download the entire wp-content folder
Exporting Options/Settings
- Lots of settings aren't exported
- Some plugins offer setting import/export functionality
- Document the settings and recreate them by hand
WXR Export Can Fail
- Too much stuff!
- Export script can timeout
- Server can run out of memory
Straight Database Backup
If the WXR Export File doesn't work, you'll have to backup the database.
Importing
Getting stuff into WordPress.
“Built-in” Import Plugins
Variety of Other Import Plugins
Importing Your WXR File
- Upload the file
- Map users from the WXR file to users in your new site
- Import attachments?
- View your imported items
If you downloaded your Uploads folder…
Upload it to your new site so the media files are in place.
Migrating
From another CMS to WordPress.
See if anyone has done the heavy lifting
- Search the WordPress plugin repository for an importer
- Search Google to see if anyone has done the same type of migration
Otherwise Prepare To Roll Your Own Solution
WARNING: This is Developer Territory
A database dump of the old site might be helpful…
but you'll probably be better off scraping the site instead!
Prep Work
- What are the different pieces?
- How does the content map to WordPress?
- What custom functionality do you need?
- How will the old content redirect to the new content?
- What content can die?
Set-up A Local Environment
Write a Script to Download and Parse Pages
- simple_html_dom - Download HTML pages and parse them like jQuery.
- cURL - For downloading images or other contnet.
Tips for your Scraping Script
- Makes it modular
- Use AJAX calls to prevent your PHP script from timing out
- Store your data in a database so you can use it again later
Test, test, test!
It will take many runs to get it just right.
After You Have Scraped All of the HTML…
Post-Migration
Make a backup of the old site, preferably easily accessible.
Helpful Tools
Plugins and resources that come in handy after a migration.
Preview Your Search & Replaces
But be careful, there is no undo!
Link Monitoring Tools
To see what broke after a migration.