Modify site URL via functions.php of a theme

My site URL in the database shows sitea.com. Is it possible to change this via functions.php into siteb.com, however still maintaining sitea.com in the database?

My current scenario is that I have three developers who work locally and we want to use one database. We all connect to a remote database, however, the URLs from our local development environment and from the remote database are different which causes broken links.

Is there some way to change the siteurl in functions.php while still having the same URL in the database?

Thanks in advance.

3 Answers
3

If instead of modifying functions.php you can modify wp-config.php, you can use the following:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Source: https://codex.wordpress.org/Changing_The_Site_URL#Edit_wp-config.php

Leave a Comment