Swing Migrations: Drupal to WordPress

I use a lot of tools when I migrate sites, and one of them that I’ve used a few times before is a WordPress importer that takes your Drupal database and migrates it into a WordPress format. It’s available here, and I’ve mentioned it a few times before – does a great job, although only a partial job (it doesn’t import images into the database and attach them, but there are other tools to do that part of it, including some I’ve written).

So this particular tool, unbeknownst to me, actually nukes your entire WordPress database before it imports the Drupal content. I’ve only ever used it on new sites before, so I didn’t think anything of it – I set it up as usual, connected it to both databases, ran the import script and …

Screen Shot 2016-07-29 at 10.24.25 AM

I found out that everything was gone. This is a site we’ve been working on for about 12 months on and off, waiting on designers, content, videos, new logos, etc – it has been a long time coming. Anyways, no big deal, I just went looking for my backup – and couldn’t find it.

It’s the best. I wanted to both throw up and lie down and cry at the same time.

Turns out I was just looking in the wrong folder, and had it restored in another 5 minutes, but it brings me to my next point – if you’re going to import data into an active site, do a swing migration. It’s simple, can be done in a few steps, and is no big deal.

Step 1.

Set up a new database, then import the contents of the existing WordPress database. In this case, I just called it temp, and gave the Drupal user access to it in preparation for the migration.

Step 2.

Perform the migration using the temp database instead of the live one.

Screen Shot 2016-07-29 at 10.30.04 AM

Step 3.

Switch the wp-config login details over to the temporary database. Make sure you save the original database login details first, comment them out or copy them to another file. The temp database should have most of the original WordPress database, so login details will be the same, everything will work, just no content will be available. Once you’re logged in, go to Tools, Export, and pick your content type and date range. For this usage case, I picked everything in the past 12 months, which was after the original database import was performed. It will save it as an XML file which you can use to import.

Step 4.

Change the wp-config login details back to the original database login details, log in, and again go to Tools, but this time go to import. Click on WordPress at the bottom, install the import plugin, and run it.

Screen Shot 2016-07-29 at 10.35.54 AM

Choose the XML file you just saved, import it, and let it run its course. You may have to change some settings if the authors don’t match, and you may run across some post duplication, but it will import everything you need.

Step 5.

Clean up the import – Drupal has some annoying quirks to it with the default settings, like using nodes and permalinks only containing numbers. Some of the tools I use to clean this up include generating post slugs to match the title, then migrating the images from these same posts (both plugins that I have written as tools to migrate Drupal to WordPress). Really, some of these steps need to be done on the temporary database before you transfer the posts to the live database, but at least you get the general picture. You’re all set at this point to continue working on your live site.

What I’ve Learned from Blogging Moms

I do a lot of different things – some of it web related, some of it IT, and a lot of it is complicated stuff. I recently helped a high school friend move her blog from wordpress.com to a self-hosted environment at bluehost. Parenting From The Heart was an easy one – not a ridiculous amount of posts, only a few sidebar items, and I was able to get through it relatively quickly. Alana then started sending me referrals for other blogger mommies who wanted to do the same thing: go from WordPress hosting (or another platform) into their very own web space. Great! Almost a niche market!


When you move between platforms there’s the usual things you have to change, such as updating permalinks, making sure featured images are set, picking a new theme and setting it up, switching DNS, etc…. but then there’s the other things you don’t think about right away. Like connecting Jetpack and getting your subscribers transferred, or re-setting up widgets because they don’t come across manually. When the blog has been well established you sometimes have to break the database file into several parts to import several times. If it’s coming from Blogger you need to import all of the images, re-do some of the permalinks for social media sharing and shareaholic, and then teach them how to use it.

So here’s what I ran into: Blogging moms know their stuff. You seriously can’t train someone this quickly to pick up on WordPress – maybe it’s just the act of being a mom makes you unafraid to just try something, and if it doesn’t work or you break it, and you can’t figure it out, THEN you ask for help. I recently migrated someone from Blogger, and I took a few screenshots to show her how to edit posts and make sure that featured images were set. Before I knew it, she had set up the slider, re-done the menu, uploaded plugins that she needed, and just had some questions about the permalinks (which were different thanks to a Blogger->WordPress import). She had never used it before and thanks to several years of blogging, blew my expectations out of the water and did some of the work herself.

Needless to say, I’m fairly impressed – it almost makes me wonder if it’s worth it to hire a mommy blogger to help out with WordPress posts and managing sites, rather than someone who dedicates themselves to managing websites on a daily basis. The difference is, they use it themselves regularly, know what works from a marketing/SEO perspective, and know how to get social linked up in a way that can be monetized on. This is the kind of thing that it takes some people years to learn! Just some food for thought…

WordPress Variable Monitoring Script

I ran into an issue with WP E-commerce recently where the shipping options appeared to be unchecked every day that we went to go and look at them. Turns out it was a line in one of the shipping files that reset the shipping array to just “shipwire” which made it appear as if someone was turning off shipping every day (or a cron job, in this case).

Read about it here: https://wordpress.org/support/topic/upgrade-to-43-and-problems-with-shipping-calculator

Anyways, I created a script to monitor changes to custom_shipping_options and thereby found out what the issue was. Here’s the code, hope it helps.


WP Hotfix 33423 WHM Easy Rollout

WordPress 4.3 has a cron issue which may affect your sites.

There is a bug in WordPress 4.3 which can affect some sites causing high CPU loads and / or Database issues.

“Just spent a few hours debugging two sites which went down and tracked it down to wp_options cron exploding in size. There apparently is a bug in 4.3 which causes the cron to grow in size. This can cause all kinds of issues, particularly when the mysql packet size is reached.
The bug has been fixed, but won’t be released until 4.3.1. If you are experiencing issues, there is a solution here :

For a quick way to transfer it to all of your client folders from within WHM, first install it onto a “donor” site, then SSH into your server, and run the following command – replacing codingconcepts with your donor user folder.  Activate from the dashboard and problem solved – or email your client to get them to activate it. This is a lot easier when you have MainWP installed on all of your client sites!

for i in cat /etc/trueuserdomains | cut -d: -d' ' -f2- ;do cp -r /home/codingconcepts/public_html/wp-content/plugins/wp33423-hotfix/* /home/$i/public_html/wp-content/plugins ;done