Difference between site_url() and home_url()?

0

The site_url() will always be the location where you can reach the site by tacking on /wp-admin on the end, while home_url() would not reliably be this location. The home_url() would be where you have set your homepage by setting General > Settings “Site Address (URL)” field.
As you can see from the figure above, site_url() refers to the wordpress core file installation URL, but home_url() refers to the home of the wordpress blog as seen by the visitors and as it is set in the WordPress site Address setting.

Other than the site_url() and home_url(), listed below are some more useful functions used to get various URLs in wordpress themes and plugins.

  • plugins_url(): Example http://www.example.com/blog/wp-contents/plugin full URL
  • includes_url(): Example http://www.example.com/blog/wp-includes full url
  • content_url(): Example http://www.example.com/blog/wp-contents full URL
  • admin_url(): Example http://www.example.com/blog/wp-admin full URL

 

Share.