Speed Up Your WordPress Workflow With WP Migrate DB Pro
Published in Web Development,
Working with databases can be a challenge if you want to work locally and then sync or deploy to a production server of some sort. There are a lot of obstacles in place that make keeping your data from being overwritten or just out of wack when moving it.
If you work with WordPress a lot like I do, you may have heard of a great plugin from Delicious Brains called WP Migrate DB Pro. This post will walk you through the amazing features of the plugin and why it’s such a valuable tool for WordPress theme developers. Easily speed up your WordPress workflow with Delicious Brain’s WP Migrate DB Pro WordPress Plugin.
What does WP Migrate DB Pro Do?
Since WordPress requires a database to operate, the WP Migrate DB Pro plugin allows you to move your data between sites. These sites can be local or remote depending on your needs. In a nutshell, the plugin keeps you from having to do any mundane MySQL operations or hunt to update links throughout your site.
My Own Experience
Prior to installing the plugin I had a workflow with WordPress that worked but was tedious and time consuming. My process was as follows:
- Work locally to change/edit or improve my WordPress site
- FTP into my hosted version of the site and add any affected files
- Export my local database file to a
- Login to my web host, access PHPMyAdmin, import the same file with the
- Go into the
wp_*tables and look for any links that don’t match the live staging site. Update those to match and then test.
This process happened for each new feature or change based on the request of a client or of my own work. What a pain right? And I didn’t even mention version control…which we all know we should make use of!
Before I digress further I realize FTP is old school. I now make use of Git and auto-deploy my files but I’ll save explaining how to do that for another time.
Using WP Migrate DB Pro
If you are familiar with version control (git, subversion, etc..) you may recognize similar features within WP Migrate DB Pro plugin’s interface.
The ability exists to push and pull data between a local server and a hosted server depending on your needs. Study the interface in the image below. From there I’ll discuss different features of the plugin and what their intended use is.
If you are planning to launch a site you can develop it locally and sync any data-based changes in real time to a staging directory for you or anyone else to view. This tool makes updates incredibly efficient if your client keeps coming back with tons of revisions for example.
To push you will need WordPress to be installed on both your local machine and your remote server. On top of WordPress, you need to have the WP Migrate DB Pro plugin active as well as licensed. Doing this is easy as uploading the plugin zip file, pressing activate, and letting the plugin license the new site for you. You can also enter your license code manually by logging in to your account over on Delicious Brain’s website and then copy and pasting it into the appropriate area under the Settings tab within the plugin on both local and hosted sites.
With everything initialized you can now setup to push your date by navigating to your hosted(remote) site and copying the secret key. Next, navigate back to your locally hosted site. Copy and paste the remote site’s secret key into the box under the pull radio option. The plugin should recognize the key and automatically connect to your remote site.
You may get an alert about SSL the first time you connect, but you can ignore it unless you need SSL on your site. Check out the documentation if this is indeed the case.
Pulling happens much like pushing but what’s going on is actually opposite. You can pull to replace your local site with a hosted(remote) site’s database. The process is very similar to copying secret keys for pushing only you’re going the opposite way. Hopefully, this is a no-brainer.
Bundled in the plugin are options such as
- Finding and replacing custom URLS
- Selecting specific database tables to migrate
- Excluding specific post types
- Replacing GUIDs
- Excluding spam comments
- Whether or not to migrate if a plugin is active or disabled
- Including or excluding temporary cached data
- Backing up the database before replacing it.
- Including media files in the migration. Media files can be compared with the migration destination and skipped if they already exist.
- Save your settings for future migrations.
Finding and replacing custom URLS
WP Migrate DB Pro automatically finds the credentials and paths it needs using it’s secret key functionality. This feature is so powerful and saves a lot of time trying to determine the right paths yourself. If the plugin didn’t have this I would definitely be on the fence about using it long-term.
Select specific database tables to migrate
By default, WP Migrate DB Pro will migrate all database tables with the prefix
wp_. These were added when you installed WordPress and are necessary to house the data you need to make your WordPress site function. You can migrate all or select only specific tables depending on what has been modified.
Exclude specific post types
If you’ve only updated, added, or edited specific post types in WordPress you probably only need to migrate those. This option allows you to determine the post types to migrate.
The WordPress Codex emphasizes that GUIDs should not be changed, though this is limited to sites that are already live. If the site has never been live, Delicious Brains recommends replacing the GUIDs. An example could be that you may be developing a new site locally at dev.somedomain.com and want to migrate the site live to somedomain.com.
Excluding spam comments
Spam comments are a pain. You can migrate them if you want, but I’d rather keep things as clean as possible.
Whether or not to migrate if a plugin is active or disabled
Sometimes you only need a plugin activated for development reasons. If that’s the case you don’t need them activated once the migration is complete to your remote site. This option allows you to toggle if this is the case or not.
Exclude temporarily cached data
WordPress makes use of transients to cache data on a given site. You can choose to include or not include this data in your migration
Backing up the database before replacing it
Whenever you’re moving data across domains you’re going to want to backup your progress. By default the plugin doesn’t give you an option NOT to backup which I appreciate. You can also choose individual tables in the database to backup.
A recent update to the WP Migrate DB Pro plugin brought us the addition of migrating media files. Now rather than having to FTP into your uploads folder you can just tick the media files option in the migration form and move them all at once. On top of that you can do a comparison during the migration to only include new media files or remove files that don’t already exist from wherever you’re migrating from.
Save Your Settings
Another amazing feature is being able to save your settings for future migrations. In a perfect world, you would only need to migrate once but in reality you’re going to move data a lot if you’re developing with WordPress locally and pushing to a remote staging or production server.
There are some nice security features bundled with the plugin that allow you to accept or reject pushing and pulling from untrusted sources. On top of that you need to have your plugin licensed and secret key saved in order to get rolling with the plugin. All of these hurdles make it rather secure for a simple WordPress plugin in my opinion.
Some notable settings are being able to adjust request sizes during a migration as well as setting a pre-configured delay time.
Depending on your installation and know-how you can make of these awesome tools to make your workflow that much more efficient.
Before WP Migrate DB Pro existed there was a variety of plugins that tried to accomplish something similar, but there was so much more room for error that doing things manually for me seemed much easier. I was hesitant to spend the money to buy the plugin because there are a lot of crappy plugins out there. I have to say I’m really relieved I did buy it. It is so much more efficient than my prior workflow that I no longer worry about moving WordPress and any data associated with it. If you build a lot of WordPress websites I strongly encourage you to try out WP Migrate DB Pro. You’ll be glad you did!