Difference between site url and home url

WordPress has 2 inbuilt functionalities to get the site url:


The site_url() will always be the location where you can reach the site by tacking on /wp-adminon the end, while home_url() would not reliably be this location. You can also get this same field by using get_bloginfo( 'wpurl' ).


The home_url() would be where you have set your homepage by setting General > Settings “Site Address (URL)” field. You can get this same field by using get_bloginfo( 'url' ) as well.

I'm Robbert Vermeulen. I document everything I learn and help thousands of people with coding WordPress. My site has no ads or sponsors. If you enjoy my content, please consider supporting what I do.


    No comments yet..

Leave a reply

Feel free to ask questions or make comments.