[wp-trac] [WordPress Trac] #24232: Don't Use the_title Filter in get_adjacent_post_rel_link()

WordPress Trac noreply at wordpress.org
Tue Apr 30 18:24:04 UTC 2013


#24232: Don't Use the_title Filter in get_adjacent_post_rel_link()
--------------------------+-----------------------------
 Reporter:  mordauk       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Template      |    Version:
 Severity:  normal        |   Keywords:  needs-patch
--------------------------+-----------------------------
 The get_adjacent_post_rel_link() function applies the `the_title` filter
 to the post title before setting it up in the `<link>` tags.

 It's really common for the `the_title` filter to be used to modify the
 actual HTML markup of post titles
 ([https://github.com/easydigitaldownloads/Easy-Digital-
 Downloads/blob/master/includes/template-functions.php#L493 see this
 example for adding product micro data]), but this results in improperly
 formatting `<link>` tags. See [https://github.com/easydigitaldownloads
 /Easy-Digital-Downloads/issues/1142#issuecomment-17244063 this github]
 issue for an example of the result.

 `get_adjacent_post_rel_link()` should be using an equivalent to
 `the_title_attribute()` instead. Since there is not a
 `get_the_title_attribute()` function, I propose two options:

 1. Introduce a `get_the_title_attribute( $post_id )` function and then use
 this in `get_adjacent_post_rel_link()`

 2. Simply remove `apply_filters()` and add in `esc_attr( strip_tags(
 $title ) )` instead.

 My vote would be to introduce a `get_the_title_attribute()` function.

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


More information about the wp-trac mailing list