Override Site URL in wp-config.php

It is possible to set the site URL manually in the wp-config.php file to override the database values. This is useful when syncing a database from the live site.

Edit wp-config.php

Add these two lines to your wp-config.php, where “example.com” is the correct location of your site.
Make sure that you include the http or https at the beginning and don't include a slash at the end. Reference: https://codex.wordpress.org/Changing_The_Site_URL
Article published 19th March 2020
Last modified 02nd November 2023