Documentation home_url() vs site_url()

home_url() vs site_url()

When working with domain-mapped sites on, home_url() and site_url() will return different values.

  • home_url() returns the primary mapped domain (e.g.
  • site_url() returns the * URL (e.g.

A few notes:

  • home_url() will only return the mapped domain on or after the init has fired. Calling it before then will return the domain.
  • If you accidentally use site_url() in your templates, theme-side links will still redirect correctly to the home_url() equivalent.
  • home_url() is the preferred method, as it avoids the above redirect.