Dynamically change [site_url] depending on current URL
-
Hi,
To provide some background, I want to work on 2 domains:
– live site, say – example.com,
– admin domain, say admin.example.comThe origin site is admin.example.com,
and example.com is the live site
(example.com synchronizes files periodically from admin.example.com)So the WP option for the site URL is x.com.
I would like some help on the following:
– when accessing the site with admin.example.com URL,
I want the site to dynamically change links to comply with being on the admin.example.com site.Here’s an example:
I go to example.com – I already have all links relative to example.com.
I go to admin.example.com, I want all blog URLs to link up relative to admin.example.com, even tough the config site URL is example.com.admin.example.com is a hypothetical example, as I need to change hosts
file entries and target example.com to admin.example.com IP for it to work.Do I have to do something more than change the site/admin URL using
add_filter('site_url', 'custom_site_url')
in the functions.php file?
Does this affect any login cookies on the admin side?So besides changing the site_url with the filter, what should I do additionally in order for the site and admin to work with admin.example.com without changing the site URL config wide?
Thanks!
- The topic ‘Dynamically change [site_url] depending on current URL’ is closed to new replies.