Million ways in WordPress to use home_url() or sister functions. The question to ask is: What function is a wrapper for other function?
To summarize, if you like to concatenate you may use:
get_bloginfo('url');
get_option('home');
If you like to have the control over scheme (http or https)
get_site_url( $blog_id, $path, $scheme );
get_home_url( $blog_id, $path, $scheme );
site_url( $path, $scheme );
Where site_url
calls get_site_url
:
function site_url( $path="", $scheme = null ) {
return get_site_url( null, $path, $scheme );
}
You may like get_bloginfo('url');
or get_bloginfo('wpurl');
since it will return:
case 'url' :
$output = home_url();
break;
case 'wpurl' :
$output = site_url();
break;
The primitive is: get_option('home')
Because function get_home_url
calls get_option('home')
.
What I wrote for get_option('home')
is similar for get_option('siteurl')
that came from get_bloginfo('wpurl')
.