featured image for a WordPress blog post

How to update site URL in a WordPress database

If you’re transferring your site from a development environment to a live or staging server, it is important to update the site URL settings before transferring the database to the new server. There are multiple ways to achieve this. Today we are going to be looking at how to update the site URL using phpMyAdmin. Before we get started we assume that you have access to cPanel through your hosting provider and know the name of the WordPress database you are trying to update.

Change the Site URL in the WordPress database.

  1. Navigate to phpMyAdmin from your hosting cPanel.
  2. Once you have selected the correct database for the site you which to change select the wp_options table.
  3. The first two tables should be siteurl and home. Select the Edit button for siteurl and then update the URL in the next step.
  4. Enter the new site URL in the table and select go to save the data. Be sure to replace ‘https://newsiteurl.com’ with your own domain name.
  5. Ensure the data has been updated. Repeat the process for the home table.
  6. Ensure both tables are updated correctly.
  7. That’s it! Your site URL and homepage should be updated in the WordPress database.

Conclusion

We have just walked through how to change the site URL and homepage directly in the WordPress database. There are also other ways to set this variable such as updating the wp-config.php file, running a SQL command to update the database, or making changes to your function.php file.

We will look at how to update these options in a future post. In the meantime, if you have any questions drop a comment below.