WordPress

WordPress Tips and Tricks

I am, by no means, an expert WordPress user. I do, however, have a few very useful administration tips that you’re likely to run across every now and then.

Changing the Domain Name

This is actually pretty simple and only takes 3 MySql commands.

Warning!
In each of the following commands, make sure you are using the correct table prefix. The default prefix is wp_, however, this may have been changed at time of install. Failure to use the correct prefix may cause irrecoverable damage to another site if you’re using a shared database installation.

1. Change the ‘home’ and ‘siteurl’ settings in wp-options

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

2. Update all post links

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

3. Update all image and uploaded content links

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
By admin on April 6, 2016 | WordPress | A comment?