title: How to set dynamic `home` and `siteurl` in WordPress?
body: <p>I config the multi-language setting dynamically using the <code>locale</code> filter. Which fetch the sub-domain name to determine the language.</p>
  
  <pre><code>function load_custom_language($locale) {
      // get the locale code according to the sub-domain name.
      // en.mysite.com =&gt; return `en`
      // zh.mysite.com =&gt; return `zh_CN`
      // tw.mysite.com =&gt; return `zh_TW`
      // etc..
  }
  add_filter('locale', 'load_custom_language');
  </code></pre>
  
  <hr>
  
  <p>That works for the index page, but when I redirect to another page, because of the settings of <code>home</code> and <code>siteurl</code>, it always redirects my site to the original one (<code>www.mysite.com</code>).</p>
  
  <p>So I'm curious to find a dynamic way to filter the <code>home</code> and <code>siteurl</code> according to the request, because I might use more than one sub-domain for mysite and I have only one settings for the two settings.</p>