Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10997 closed defect (bug) (fixed)

XHTML in comments_popup_link title attribute

Reported by: ewestp's profile ewestp Owned by: xenlab's profile xenlab
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: Comments Keywords: has-patch needs-testing
Focuses: Cc:


If a post title contains XHTML markup, the markup is included in the title attribute of the Comments link. See To fix the problem, I suggest that line 973 in wp-includes/comments-template.php (version 2.8.5) be changed from

$title = esc_attr( get_the_title() );


$title = the_title_attribute('echo=0');

Attachments (2)

comment-template.php.diff (474 bytes) - added by ewestp 15 years ago.
Changed the line described above
10997-2.diff (453 bytes) - added by xenlab 15 years ago.
Refreshed the patch against 2.9-beta2 (r12338)

Download all attachments as: .zip

Change History (9)

#1 @scribu
15 years ago

  • Milestone changed from Unassigned to 2.9

15 years ago

Changed the line described above

#2 @ewestp
15 years ago

  • Keywords has-patch added

#3 @scribu
15 years ago

Related: #11040

#4 @ewestp
15 years ago

Here is a simple test to highlight the problem.

1) Using the default theme, make a new post with the title

The &lt;em&gt; tag adds <em>emphasis</em>

2) On the front page, mouse over the permalink made from the post title. The title attribute looks nice--no tags around the word 'emphasis'.

3) Mouse over the link to the post's comments. The title attribute looks messy because there are tags around the word 'emphasis' which obviously don't belong there.

Why aren't the links' title attributes consistent? Because the permalink uses the_title_attribute() to construct a clean title attribute (a function that seems to have been made expressly for that purpose), and comments_popup_link() does not.

If you use the search-everything plugin with highlighting enabled, search for any of the words in the post's title and witness the horror that is the title attribute of the comments link.

15 years ago

Refreshed the patch against 2.9-beta2 (r12338)

#5 @xenlab
15 years ago

  • Cc wp@… added
  • Owner set to xenlab
  • Status changed from new to accepted

Patch has gone stale, so I refreshed it.

#6 @xenlab
15 years ago

  • Keywords needs-testing added

#7 @markjaquith
15 years ago

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

(In [12362]) Strip HTML from comments_popup_link title attribute. props ewestp, xenlab. fixes #10997

Note: See TracTickets for help on using tickets.