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

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 3 01:01:00 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:  Unassigned
Component:  Template      |     Version:  2.9       
 Severity:  normal        |    Keywords:            
 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:

 >       $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

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

More information about the wp-trac mailing list