Setting up new hostname with WordPress database

For setting up new hostname with WordPress database is required while moving site to new hostname. For this following SQL commands. In following example we are moving site with hostname dev.example.com to hostname www.example.com.

[php]
UPDATE wp_options SET option_value = REPLACE(option_value,’http://dev.example.com’,’http://www.example.com’);
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,’http://dev.example.com’,’http://www.example.com’);
UPDATE wp_posts SET guid = REPLACE(guid,’http://dev.example.com’,’http://www.example.com’);
[/php]

Nishant Vaity

Knowledgeable and skilled Technology Lead with an ability of software development and supervision. Possess a Bachelor of Science (BS) in Information Technology along with 10+ years of experience with hands-on coding and team management. By profession, I am a Software Engineer, Technology Mentor & Entrepreneur. Passionate about the technologies I use and always eager to share & learn more from that passion.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: