Make WordPress Core

Opened 20 years ago

Closed 20 years ago

#3623 closed defect (bug) (fixed)

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

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

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 20 years ago.

Download all attachments as: .zip

Change History (9)

#1 @dd32
20 years ago

  • Milestone 2.1
  • Priority low → lowest
  • Resolution → fixed
  • Status new → closed
  • Version 2.1

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
20 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
20 years ago

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

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

#4 @rob1n
20 years ago

  • Owner changed from anonymous to rob1n
  • Status reopened → 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
20 years ago

  • Keywords dev-feedback 2nd-opinion added; site_url removed
  • Status new → assigned

@rob1n
20 years ago

#6 @rob1n
20 years ago

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

#7 @rob1n
20 years ago

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

#8 @ryan
20 years ago

  • Resolution → fixed
  • Status assigned → closed

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

Note: See TracTickets for help on using tickets.