WordPress Multisite: Need to access all sites from different url (need to update site address url and wordpress address url)

  multisite, php, wordpress

What I am trying to achieve:

There is a wordpress multisite setup using subfolders approach. There are couple of sites like

which needs to be access from


The wordpress multisite is deployed on a url of type site.privateurl.client.com. What I need to do now is to make available wordpress from a different url (e.g site.publicurl.com) as privateurl is behind vpn layer and only publicurl will be open to end users. There is already a infra setup done which redirects all requests landing to site.publicurl.com to site.privateurl.client.com. But this fails as wordpress internally calls privateurl which isn’t accessible outsite vpn.

While running a normal wordpress instance (without multisite), I was able to do it very easily. Just logged in as admin and then go to General Settings and update these 2 fields with new public url (ref image below)

  1. WordPress Address (URL)
  2. Site Address (URL)

Tested the same and it was working well
enter image description here

The problem is coming when I am using wordpress multisite now. I am not getting any option in the network admin dashboard or in the sites created to update the url.

Read a lot of options and tried them as well such as:

  1. Update function.php in the theme of subsites using
update_option( 'siteurl', 'https://site.publicurl.com' );
update_option( 'home', 'https://site.publicurl.com' );
  1. Updated wp-config.php by adding the following lines:
define( 'DOMAIN_CURRENT_SITE', 'site.publicurl.com');
define('WP_SITEURL', 'https://site.publicurl.com');
define('WP_HOME',    'https://site.publicurl.com');
  1. Tried this plugin also which I found in one of the answers.

None of the above seem to work.

The only option which I have not tried is to directly update the database as mentioned in multiple articles like https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/ or https://wordpress.stackexchange.com/a/334109/209261. This option isn’t feasible for me as I won’t have direct db access to update the tables. or Is there a way to update db from my wordpress via some custom code?

There is one option which one of the answers says to use update_site_option but I am not really sure on how to go about using it. Can someone guide through an example of where to use this function if it is going to be useful here?

Reference to few links for above approaches:

  1. https://wordpress.stackexchange.com/questions/327424/how-do-i-change-the-multisite-url
  2. https://wordpress.org/support/article/changing-the-site-url/

Any help on how to fix this will be highly appreciated. Please let me know if there is any additional information needed.

Source: Ask PHP