Difference between site url and home url

WordPress has 2 inbuilt functionalities to get the site url:

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' ).

home_url();

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.

Leave a reply

Feel free to ask questions or make comments.

Comments

    No comments yet..