Blog

Manually change WordPress URL

Manually change WordPress URL
28 Jul 2020 | General | 0

Manually change WordPress URL

After moving your WordPress to a new domain, use either of the following methods to update your installation to the new domain.

MySQL queries

Execute the following MySQL statements in phpMyAdmin or terminal after login.

UPDATE wp_posts SET guid = replace(guid, 'NEW URL','OLD URL');
UPDATE wp_posts SET post_content = replace(post_content, 'NEW URL','OLD URL');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'NEW URL','OLD URL');

wp-config.php

define('WP_HOME','YOUR_DOMAIN.com');
define('WP_SITEURL','YOUR_DOMAIN');

Now you can login to your admin dashboard and update settings as needed.

Theme functions.php

update_option('siteurl','YOUR_DOMAIN.COM');
update_option('home','YOUR_DOMAIN.COM');

Discussion