In your WordPress Admin area, under Settings > General Section, you can see two input fields named WordPress Address (URL) and Site Address (URL) which will auto-populate with the value when you set up a WordPress site.
site_url() function returns the WordPress Address (URL) value. It refers to the directory where you have all WordPress files and folders. For example, if your domain name is https://example.com and the site_url() function returns https://example.com/blog, it means your WordPress is installed from the blog directory. So your admin page URL will be like this: https://example.com/blog/wp-admin.
home_url() function returns the Site Address (URL) value. It means that where you have set your homepage. For example, if you set your Site Address (URL) to https://example.com/homepage and try to visit your site home page, then you can see this( https://example.com/homepage ) URL on your address bar and other page URLs followed by this like https://example.com/homepage/about. But your admin URL will be like this( https://example.com/wp-admin ). It will not be like this( https://example.com/homepage/wp-admin ).
One thought on “What’s the Difference Between WordPress Address (URL) and Site Address (URL)?”
Appreciate this post. Will try it out.