Sometimes, you may want to hardcode the website path URL in WordPress. A good example is if you cannot get to the admin section. Changing the site URL is particularly useful for those who need to update their website’s domain name or move their site to a different server.
To do this, you will need to have access to the files.
Add the following to the wp-config.php file:
define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);
For detailed information refer to the WordPress documentation, Changing The Site URL.