WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#3623 closed defect (bug) (fixed)

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

Reported by: dd32 Owned by: 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 8 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @dd329 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..

comment:2 @Viper007Bond9 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.

comment:3 @markjaquith9 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.

comment:4 @rob1n8 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...

comment:5 @rob1n8 years ago

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

@rob1n8 years ago

comment:6 @rob1n8 years ago

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

comment:7 @rob1n8 years ago

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

comment:8 @ryan8 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.