From 9ee57d58a44a1cfa33abeddb64de269d9c72a42c Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 27 Feb 2010 18:57:04 +0000 Subject: [PATCH] Standardize filters for single_(post|cat|tag|month)_title() on strip_tags() and wptexturize(). fixes #10900 props scribu git-svn-id: http://svn.automattic.com/wordpress/trunk@13467 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 6 ++++++ wp-includes/general-template.php | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 44c91b974..d6c99716c 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -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' ); diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index e8b765a49..4edfc4467 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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; } }