When working with domain-mapped sites on WordPress.com,
site_url() will return different values.
home_url()returns the primary mapped domain (e.g. vippuppies.com)
site_url()returns the *.wordpress.com URL (e.g. vippuppies.wordpress.com)
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
- If you accidentally use
site_url()in your templates, theme-side links will still redirect correctly to the
home_url()is the preferred method, as it avoids the above redirect.