[theme-reviewers] get_option('home') bloginfo('url') and home_url()

Edward Caissie edward.caissie at gmail.com
Wed Sep 15 16:41:54 UTC 2010


Andrew Nacin wrote this a couple of weeks ago when these functions first
came up on the list:

In a nutshell, home_url() is to get_bloginfo('url') or get_option('home'),
> as site_url() is to get_option('site_url') or get_bloginfo('wpurl');
>
> The difference between the _url() functions and get_option/get_bloginfo is
> that the _url() functions handle schemes, specifically, HTTPS versus HTTP.
> Thus these are extremely important for sites that want to force SSL on the
> frontend, admin, or login.
>
> The difference between site and home is the following. Otto is correct that
> they have to do with the two address fields on the General Settings page.
> Specifically, SITE is always where the WP files are actually located, and
> HOME *may* be /blog. In 99% of cases, a theme will want to use home_url().
>

So I would look at using home_url() as a recommendation over
get_option("home") as well, not required ... but definitely good practice.


Cais.


2010/9/15 Chip Bennett <chip at chipbennett.net>

> Ah, I get it. :)
>
> IMO (and others more expert might have good reason to disagree), anytime a
> *get_X()* or *get_bloginfo( 'X' )* function exists, *get_option( 'X' )*should not be used. It would seem that using the variable explicitly defined
> for 'X' is the safer/preferred route.
>
> Thoughts?
>
> Chip
>
>
> On Wed, Sep 15, 2010 at 11:31 AM, yulian yordanov <yul.yordanov at gmail.com>wrote:
>
>> Oh, I wanted to ask something different. I'm sorry, English is not my
>> native language you know :/
>> I know home_url is recommended for bloginfo('url') but I'm wondering about
>> get_option(home). Seems it produces the same result /home URL/ so can I
>> replace get_option(home) with home_url() too?
>>
>> Yulian <Fingli>
>>
>> 2010/9/15 Edward Caissie <edward.caissie at gmail.com>
>>
>> As a recommendation is fine for now ... it might get a 'strongly' added to
>>> it, but not yet.
>>>
>>>
>>> Cais.
>>>
>>> 2010/9/15 Chip Bennett <chip at chipbennett.net>
>>>
>>> Using *home_url()* is actually already listed as *recommended *in the
>>>> Guidelines, but is not *required*.
>>>>
>>>> That's probably a good balance for the time being, I think.
>>>>
>>>> Chip
>>>>
>>>> On Wed, Sep 15, 2010 at 11:15 AM, yulian yordanov <
>>>> yul.yordanov at gmail.com> wrote:
>>>>
>>>>>  Hi,
>>>>> Hmm, is there significant difference between get_option('home') and
>>>>> bloginfo('url')? Can I recommend using *echo home_url('/')* instead?
>>>>>
>>>>> --
>>>>> Юлиян Йорданов
>>>>>
>>>>> Yulian Yordanovhttp://post-scriptum.info/
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> theme-reviewers mailing list
>>>>> theme-reviewers at lists.wordpress.org
>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> theme-reviewers mailing list
>>>> theme-reviewers at lists.wordpress.org
>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>
>>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>>
>> --
>> Юлиян Йорданов
>>
>> Yulian Yordanov
>> post-scriptum.info
>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20100915/e8b41623/attachment-0001.htm>


More information about the theme-reviewers mailing list