[wp-trac] [WordPress Trac] #11699: adjacent_post_link fails to strip anchor tags from post titles

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 14 19:32:28 UTC 2010


#11699: adjacent_post_link fails to strip anchor tags from post titles
--------------------------+-------------------------------------------------
 Reporter:  jaylett       |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.0
Component:  Template      |     Version:  2.9
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------
Changes (by nacin):

  * milestone:  Unassigned => 3.0


Old description:

> If you create a post with a title of "Started using <a
> href='http://wordpress.org/'>WordPress</a>", adjacent_post_link() emits a
> link that has that entire string (including the anchor tags) inside its
> own link.
>
> The expected behaviour would be to strip the anchor tag to leave the link
> generated to the WordPress post.
>
> This would then match being able to put links in post titles and using
> template code such as <h2><?php the_title(); ?></h2> which results in a
> heading with the appropriate title including the link that is part of the
> title. (If you see what I mean.)
>
> A (but possibly the wrong) fix is to strip the anchor tags using:
>
> 1265a1266,1268
> >       $allowed_html_in_titles = $allowedtags;
> >       unset($allowed_html_in_titles['a']);
> >       $title = wp_kses($title, $allowed_html_in_titles);
>
> applied to wp-includes/link-template.php

New description:

 If you create a post with a title of "Started using <a
 href='http://wordpress.org/'>WordPress</a>", adjacent_post_link() emits a
 link that has that entire string (including the anchor tags) inside its
 own link.

 The expected behaviour would be to strip the anchor tag to leave the link
 generated to the WordPress post.

 This would then match being able to put links in post titles and using
 template code such as <h2><?php the_title(); ?></h2> which results in a
 heading with the appropriate title including the link that is part of the
 title. (If you see what I mean.)

 A (but possibly the wrong) fix is to strip the anchor tags using:
 {{{
 1265a1266,1268
         $allowed_html_in_titles = $allowedtags;
         unset($allowed_html_in_titles['a']);
         $title = wp_kses($title, $allowed_html_in_titles);
 }}}
 applied to wp-includes/link-template.php

--

Comment:

 Maybe we should instead strip all tags?

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


More information about the wp-trac mailing list