I am developing a plugin.
I want to know difference between
get_bloginfo('url');
and
get_site_url();
I got same output, then what’s the difference?
I am developing a plugin.
I want to know difference between
get_bloginfo('url');
and
get_site_url();
I got same output, then what’s the difference?
You must be logged in to post a comment.
get_bloginfo('url')
callshome_url()
callsget_home_url()
reads optionhome
get_bloginfo('wpurl')
callssite_url()
callsget_site_url()
reads optionsiteurl
get_bloginfo('siteurl')
andget_bloginfo('home')
are deprecated arguments and returnget_bloginfo('url')
(siteurl
argument is documented wrong in Codex as equal towpurl
, it’s not in current code)The difference is that these two function chain to different options, which are typically same.
It would be more appropriate to compare
get_bloginfo('url')
toget_home_url()
orget_bloginfo('wpurl')
toget_site_url()
. Then the answer is that these functions are on different level in chain. Typically the deeper function is – the more flexible it is and the less filters output passes through.From ‘wp-includes/general-template.php’
So:
get_bloginfo('home')
,get_bloginfo('siteurl')
andget_bloginfo('url')
are equivalent to callinghome_url()
(also note that the use of home and siteurl as get_bloginfo parameters is deprecated)get_bloginfo('wpurl')
is the same as callingsite_url()
Check out the parameters over at Codex:
get_site_url /
get_bloginfo
IIRC, the primary difference between
home_url()
/get_site_url()
and theirget_bloginfo()
analogs is thathome_url()
/get_site_url()
return the proper http/https scheme, whileget_bloginfo()
doesn’t.