How to Change a WordPress Website Domain Name

This tutorial shows how to manually change a WordPress domain in as little as five minutes or less.

Apr 27, 2026

How to Change a WordPress Website Domain Name

Steps to changing your domain name in WordPress:

  1. Visit phpMyAdmin and select the database. (Note that if you don’t know what your database is, you can get it from your wp-config file in DB_NAME.)
  2. Then click on the SQL tab.
  3. Next, paste the code below:
    UPDATE wp_options
    SET option_value = 'https://newdomain.com'
    WHERE option_name IN ('siteurl', 'home');
    
    UPDATE wp_posts
    SET post_content = REPLACE(post_content, 'olddomain.com', 'newdomain.com');
    
    UPDATE wp_postmeta
    SET meta_value = REPLACE(meta_value, 'olddomain.com', 'newdomain.com');
  4. Make sure that the table prefix matches what is on your WordPress installation. You can also find your table prefix in your wp-config file. Simply open the wp-config file and search for $table_prefix. The default is often wp_ but some installations change this to something else.
  5. After confirming, click on Go in your bottom right.
  6. The code contains three queries so you’d see three green lines showing your query ran successfully.
  7. Visit your new domain and all should be working properly.

If you have any issues, kindly chat me up on LinkedIn.