Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#3623 closed defect (bug) (fixed)

get_bloginfo('site_url') returns 'home' option, which is confusing

Reported by: dd32's profile dd32 Owned by: rob1n's profile rob1n
Milestone: 2.2 Priority: lowest
Severity: minor Version: 2.1
Component: Template Keywords: has-patch
Focuses: Cc:

Description

According to the Template tags for get_bloginfo()


'url' - the Blog address (URI) is the URL for your blog's web site address and is set in Administration > Options > General. This data is retrieved from the home record in the wp_options table.
'home' - returns the same value as 'url'.
'site_url' - returns the same value as 'url'.



however the output when using latest SVN: (2.1-RC2 revision 4776)

get_bloginfo(""); "blog title"
get_bloginfo('url');
"blog url"
get_bloginfo('home'); "blog url"
get_bloginfo('site_url');
"blog title"

It may be that site_url has been depreciated(as it seems to be given that 'url' should just be used), however it may break some templates/plugins if its not included for backwards compatibility.

Attachments (1)

3623.diff (10.0 KB) - added by rob1n 18 years ago.

Download all attachments as: .zip

Change History (9)

#1 @dd32
18 years ago

  • Milestone 2.1 deleted
  • Priority changed from low to lowest
  • Resolution set to fixed
  • Status changed from new to closed
  • Version 2.1 deleted

tracked down the get_bloginfo() function:


case 'url' :
case 'home' :
case 'siteurl' :

$output = get_option('home');
break;


Not having used Wordpress before now, i was unsure, I've just delved into the 2.1 source, and also the 2.0 source and noticed that it is indeed listed as 'siteurl' in both.. which means its probably just a wiki update instead..
Updating the wiki page..

#2 @Viper007Bond
18 years ago

Those should actually probably just be removed from the docs so people don't use them. I believe they're only there for backwards compatibility.

#3 @markjaquith
18 years ago

  • Milestone set to 2.2
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Summary changed from get_bloginfo('site_url') not returning expected value. to get_bloginfo('site_url') returns 'home' option, which is confusing
  • Version set to 2.1

Agreed. We should deprecate some of these redundant (and immensely confusing) things.

#4 @rob1n
18 years ago

  • Owner changed from anonymous to rob1n
  • Status changed from reopened to new

But is this a code issue, or a documentation issue? We're going to have to keep those legacy options in the code, but we should not even *mention* the legacy options in the documentation. And we probably should add CLEAR comments that these are DEPRECATED and may be REMOVED at any time. Feel free to interchange the caps.

Of course, considering how well our warnings worked for the $table* business...

#5 @rob1n
18 years ago

  • Keywords dev-feedback 2nd-opinion added; site_url removed
  • Status changed from new to assigned

@rob1n
18 years ago

#6 @rob1n
18 years ago

Patch adds appropriate comments, and changes all instances of bloginfo('home') to bloginfo('url').

#7 @rob1n
18 years ago

  • Keywords has-patch added; dev-feedback 2nd-opinion removed

#8 @ryan
18 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4983]) Standardize on 'url' for fetching the blog's url. Props rob1n. fixes #3623

Note: See TracTickets for help on using tickets.