Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

ostrunk on "add_filter doesn't work for post_title"

$
0
0

Hi everybody,

I got a small problem with a filter I want to add to the output of my content. I have the following function for replacing some quotes (added a space in the entitys so the comment system doesn't interpret my code as HTML):

function removesmartquotes($content) {
     $content = str_replace('&# 8220;', '& laquo;', $content);
     $content = str_replace('&# 8221;', '& raquo;', $content);
     $content = str_replace('&# 8216;', '& lsaquo;', $content);
     $content = str_replace('&# 8217;', '& rsaquo;', $content);

     return $content;
}
add_filter('the_content', 'removesmartquotes');
add_filter('the_title', 'removesmartquotes');
add_filter('wp_title', 'removesmartquotes');
add_filter('comment_text', 'removesmartquotes');
add_filter('the_excerpt', 'removesmartquotes');

Since I'm generating a pdf from the output, I use

$post = get_post($_POST['postid']);

and after that

$post->post_content
$post->post_title

etc. to display the content. The output auf post_content is fine (the quotes are beeing replaced), but post_title remains with the standard-quotes. Is there a special filter I have to apply and if so, on which function?

Tl;dr: I want to replace a HTML entity but $post->post_title still shows the initial value.

Kind regards


Viewing all articles
Browse latest Browse all 8245

Trending Articles