Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#3903 closed defect (bug) (fixed)

Admin header should use bloginfo rather than get_option for blog name

Reported by: jhodgdon Owned by:
Milestone: 2.2 Priority: normal
Severity: normal Version: 2.1.2
Component: Administration Keywords: has-patch
Focuses: Cc:


When on the Admin pages of WordPress, admin_header.php puts the blog's name on the screen in big type at the top, by calling get_option('blogname'). This is a problem because it is not really possible to filter this text, to make it look reasonable, and some plugins might want/need to (e.g. Polyglot).

The reason you cannot filter get_option('blogname') is because the options put into the option-setting form from options_general.php (i.e. the General tab of the Options section of the Admin screens) are also derived from get_option. So if you define a filter for get_option_blogname, then that filter will also be used to filter what goes into the option-setting form. But the form needs to display unfiltered actual input so the user can see what is actually in the database.

The solution is to use bloginfo('name') in the admin header in place of get_option('blogname'), because bloginfo can definitely be filtered. Also the blog title displayed on the admin form is then more consistent with the standard used to display the blog's name in the default theme (and many other themes) in the blog header.

Attachments (2)

admin-header-php.diff (975 bytes) - added by jhodgdon 11 years ago.
admin-header-php3.diff (1013 bytes) - added by jhodgdon 11 years ago.
Working patch that filters correctly

Download all attachments as: .zip

Change History (9)

#1 @jhodgdon
11 years ago

  • Keywords has-patch added

#2 @ryan
11 years ago

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

(In [4982]) Use get_bloginfo to get the blog name. Props jhodgdon. fixes #3903

#3 @jhodgdon
11 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The applied fix does not work, because get_bloginfo is not filtered any more than get_option is filtered.

I realize why the fix I had suggested was not applied (because bloginfo echos the result, which means the texturize is not really applied), but definitely the fix that was put in is no good either.


#4 @jhodgdon
11 years ago

By the way, I just tested in [5243].

11 years ago

Working patch that filters correctly

#5 @jhodgdon
11 years ago

  • Keywords has-patch added; needs-patch removed

The patch I just added does the filtering correctly, works in [5243], and still applies wp_texturize. Any way it could be added to 2.2?

#6 @rob1n
11 years ago

wptexturize() is added as a filter to 'bloginfo' in default-filters.php already.

#7 @rob1n
11 years ago

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

(In [5268]) Just use bloginfo(). Props jhodgdon. fixes #3903

Note: See TracTickets for help on using tickets.