[wp-trac] [WordPress Trac] #16463: the_title_attribute() bug

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 5 14:04:10 UTC 2011


#16463: the_title_attribute() bug
-------------------------------+------------------------------
 Reporter:  facemann_ru        |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Template           |     Version:  3.0.4
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------

Comment (by facemann_ru):

 Replying to [comment:2 dd32]:
 > Where are you trying to use this function?
 >
 > It's not supposed to output html, thus the 'attribute' part of the
 function name.
 >
 > This function is designed to be used in this context:
 > {{{
 > <a href="" title="<?php the_title_attribute(); ?>">
 On my site users can add posts themselves. There are many moderators.

 I wanted to use this function to strip any HTML from the title, because of
 it can be added from the admin panel. Unwanted HTML can break design.

 So, I have to use:

 {{{
 echo '<h1><span>' . esc_attr(strip_tags($title)) .
 '</span><ins></ins></h1>';
 }}}

 This code is more convenient:

 {{{
 the_title_attribute('before=<h1><span>&after=</span><ins></ins></h1>');
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16463#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list