Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#7084 closed defect (bug) (fixed)

Widget titles need to be auto-escaped.

Reported by: otto42's profile Otto42 Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.5.1
Component: Widgets Keywords: has-patch tested commit
Focuses: Cc:

Description

Reference: http://wordpress.org/support/topic/180280

Short version: An ampersand in the title of a widget causes an output of just the ampersand instead of the html amp; code. This results in validation failure.

Solution: Widget titles and possibly text widgets need to be html escaped before output onto the page.

Attachments (2)

default-filters.php.diff (555 bytes) - added by jtatum 16 years ago.
Implementing widget_title filter
7084.diff (556 bytes) - added by Denis-de-Bernardy 16 years ago.
add filter to all widget titles

Download all attachments as: .zip

Change History (10)

@jtatum
16 years ago

Implementing widget_title filter

#1 @jtatum
16 years ago

The attached patch implements the widget_title filter. A quick scan of widgets.php shows that most widgets invoke this filter for the widget title, however it is not implemented by default. Figuring that titles for widgets would be similar to most other titles, this is generally used in a way similar to the blog's title, this small diff applies the same filter sets as are applied to wp_title.

#2 @jtatum
16 years ago

  • Cc jtatum added

#3 @jtatum
16 years ago

  • Keywords has-patch added

#4 @ryan
16 years ago

  • Component changed from General to Widgets
  • Owner anonymous deleted

@Denis-de-Bernardy
16 years ago

add filter to all widget titles

#5 @Denis-de-Bernardy
16 years ago

  • Keywords tested added

#6 @Denis-de-Bernardy
16 years ago

  • Keywords commit added
  • Milestone changed from 2.9 to 2.8

#7 @Denis-de-Bernardy
16 years ago

credit should go to jtatum, I hadn't noticed his patch.

I just checked that it doesn't break the HTML added in the RSS widget's title, and things are fine.

#8 @ryan
16 years ago

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

(In [11208]) texturize widget titles. Props jtatum. fixes #7084

Note: See TracTickets for help on using tickets.