Standardize filters for single_(post|cat|tag|month)_title() on strip_tags() and wptexturize(). fixes #10900 props scribu

git-svn-id: https://develop.svn.wordpress.org/trunk@13467 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-02-27 18:57:04 +00:00
parent 7f3a30a9c0
commit d448472adf
2 changed files with 11 additions and 5 deletions

View File

@ -86,6 +86,12 @@ foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description',
add_filter( $filter, 'esc_html' );
}
// Format titles
foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title' ) as $filter ) {
add_filter( $filter, 'wptexturize' );
add_filter( $filter, 'strip_tags' );
}
// Format text area for display.
foreach ( array( 'term_description' ) as $filter ) {
add_filter( $filter, 'wptexturize' );

View File

@ -574,7 +574,7 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
// If there is a post
if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
$post = $wp_query->get_queried_object();
$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
$title = apply_filters( 'single_post_title', $post->post_title );
}
// If there's a taxonomy
@ -652,9 +652,9 @@ function single_post_title($prefix = '', $display = true) {
}
$title = apply_filters('single_post_title', $post->post_title, $post);
if ( $display )
echo $prefix . strip_tags($title);
echo $prefix . $title;
else
return strip_tags($title);
return $title;
}
/**
@ -687,9 +687,9 @@ function single_cat_title($prefix = '', $display = true ) {
$my_cat_name = apply_filters('single_cat_title', $cat->name);
if ( !empty($my_cat_name) ) {
if ( $display )
echo $prefix . strip_tags($my_cat_name);
echo $prefix . $my_cat_name;
else
return strip_tags($my_cat_name);
return $my_cat_name;
}
}