From 60c9de28b4253360547e03a5b8b3dd75a9477348 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Tue, 23 Jul 2013 16:05:40 +0000 Subject: [PATCH] Allow `the_title_attribute()` to receive a `post` argument, and use this in `get_adjacent_post_rel_link()` to make sure tags are stripped from the title output there. Fixes #24232. git-svn-id: http://core.svn.wordpress.org/trunk@24783 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 7 +++---- wp-includes/post-template.php | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index c948ab884c..719754985a 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1220,16 +1220,15 @@ function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $ex if ( empty($post) ) return; - if ( empty($post->post_title) ) + $post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) ); + + if ( empty( $post_title ) ) $post_title = $previous ? __('Previous Post') : __('Next Post'); - else - $post_title = $post->post_title; $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post_title, $title); $title = str_replace('%date', $date, $title); - $title = apply_filters('the_title', $title, $post->ID); $link = $previous ? " '', 'after' => '', 'echo' => true, 'post' => get_post() ); + $r = wp_parse_args($args, $defaults); + extract( $r, EXTR_SKIP ); + + $title = get_the_title( $post ); if ( strlen($title) == 0 ) return; - $defaults = array('before' => '', 'after' => '', 'echo' => true); - $r = wp_parse_args($args, $defaults); - extract( $r, EXTR_SKIP ); - $title = $before . $title . $after; $title = esc_attr(strip_tags($title));