I was working tonight on what should have been a straightforward WordPress migration from my staging site to my client’s live site. It should have taken less than an hour but took me 8 hours instead!! From 6-1am on a snowy Saturday. I literally just finished it, and here are some tips that I am going to share before I crash for the night.
Problem 1: Installed WordPress from within the web host control panel. Links and things did not work. That took a couple hours to debug.
Tip 1: I did not realize that web hosts bundle the WordPress install with junk and themes and plugins that are NOT part of a fresh WordPress install. That messed up the site because of these junk plugins. Always install WordPress as a fresh download from wordpress.org, and do NOT use the web host’s application to install WordPress. Yeah, it takes longer, but you’re ensured that it’s truly a clean install and not bundled with junk. Now make sure you can obtain the database username and password. For some reason, this web host that I was using did not supply that, but I was able to get it from the wp-config.php when I opted for the control panel install. I copied that down, then deleted the whole thing and started with a fresh, manual install.
Problem 2: Ok, WordPress system is finally working. Next, I tried to activate the new theme (Envato’s Enfold theme), and I got an HTTP 500 error. The default themes did not produce such errors. Ugh. I tried soooooooooo many different things, but I could have saved myself 3 hours of work if I had just done this:
Tip 2: Edit wp-config.php and set DEBUG to TRUE.
This will right away produce error messages that you can Google to figure out what the problem is. I had a PHP memory overload issue.
Problem 3: Now I need to increase PHP memory limit. Contrary to everything I read online, NOTHING WORKED. Editing wp-config.php to add define(‘WP_MEMORY_LIMIT’, ‘256M’); did not have any effect. Editing .htaccess to add add php_value memory_limit 256M only produced internal server errors.
Tip 3: To solve PHP memory overload issue, create a php.ini file in both WordPress root folder AND wp-admin folder. This was the only thing that worked for me. Here is the code that I used:
upload_max_filesize = 1000M
post_max_size = 2000M
memory_limit = 3000M
file_uploads = On
max_execution_time = 180
That only took about 2 hours to figure out, but thankfully Google helped me out on that one. The theme was finally able to be activated!! I rewarded myself with a bite of chocolate and continued onward.
Bonus tip: Use Live Preview to see if it activates the theme. This is an easy way to identify problems without having to actually activate the theme, be faced with an HTTP 500 error, and then have to rename the theme folder, or go into PHPMyAdmin and manually tell WordPress to use a different theme.
Problem 4: Alright, now that WordPress is functioning and the theme is finally activated, time to import the content using the built-in WordPress Importer tool. Of course, this crashed multiple times. WordPress kept timing out because the content was so large.
Tip 4: Upload your content in batches. So export the posts and upload. Then export the pages and upload. Export the media and upload. This is a much easier process. Media might take a few tries to get it uploaded, but it won’t duplicate your images, so just keep re-uploading the file until you finally get the “all done, have fun” message. Also, with this method, you do not have to actually upload the Uploads folder into wp-content folder, as the WP Importer will do it all for you and display them in the Media library.
Problem 5: Alright, now WordPress is up, theme is activated, content is live, and I am faced with hundreds of links pointing to my old site. So I figure I’ll download a plug-in and get them all changed to the new URL to avoid database serialization problems. Problem is, the plug-ins out there don’t work. I tried Velvet Blues first. That only changed like 2 things. Then I tried Search and Replace. When I went to activate it, I got a fatal error.
Tip 5: The only plug-in that worked for me is Better Search and Replace. You can even do a dry run first. It’s free, and it worked, simple as that. Remember to back-up your database first!!!
Final Tip: If possible, and client-willing, use a web host that actually works with WordPress from the get-go. I highly recommend Site5. I’ve been with them since 2006. Everything just works…I have never encountered any of the issues above. I’ve installed WordPress from the control panel and it works and does not have any of the junk added in. I was able to add Envato’s themes with no problem. I’ve never encountered any PHP memory limits with them. I’m on the HostPro+Turbo package.
I did have an issue a while back where I tried to migrate to a VPS server and it was a HORRIBLE experience. I ended up canceling that whole thing, but not without a lot of down time, stress, and feeling terrible for my poor clients. If you just start out fresh on a VPS server, you’d probably be okay though. Their email server is also horrible and gets black-listed by many email providers and is filled with spam, even though I am supposedly on a “dedicated IP.” It’s all still shared hosting in my opinion. So get Google Apps for your email. If my clients want email, that’s what I put them on. Otherwise, the in-house email from the control panel is spammy and terrible.
But to use Site5 just as a good ol’ fashioned web host, they are the best! All my client sites are hosted with Site5, except for one. That one is hosted on BlueHost, and they are another terrible provider. Their email server is also black-listed, and their customer support is bad. Stay away.
All WordPress developers will know that the HTML editor inside WordPress is a complete joke. It rearranges everything, closes tags, and mangles all your code. This is due to 2 built-in WordPress modules, Auto P and Texturize. The 2 magical lines that will disable these modules and turn the HTML editor into a normal, functioning, pure HTML editor are these:
Open the theme’s functions.php file. Inside the PHP code, put:
remove_filter (‘the_content’, ‘wpautop’);
That’s it! By the way, to turn the Visual Editor off, go to your User Profile and click the checkbox at the top.
You would think they would make the instructions easier about how to do this. I did a fair bit of searching after my client posed this same exact question to me. The answer is that you have to sign up to get an account at Gravatar:
Associate your Gravatar account with all the email addresses that you use when commenting in blogs. Upload the image you want to use as your avatar, associate it with the email address, and voila…it will now magically appear next to your comments.
All avatars are controlled at Gravatar.com. Get one now, it’s much more interesting than seeing the mystery man icon everywhere.
And PS: Check out my new website https://www.awdesigns.com. After contemplating what to do with this blog, I have decided I will move it to my new website soon. Perhaps over Thanksgiving.