Home Ask Login Register

Developers Planet

Your answer is one click away!

Samir Karmacharya February 2016

How can i get inverted coma instead of apostrophe in wordpress content frontend

I write inverted comma on admin tinymce editor but on frontend it displays an apostrophe when I use:


But when I use

echo get_the_content();

it will display inverted comma.

And when I use

$content=apply_filters( 'the_content', $content );
echo $content = str_replace(']]>', ']]>', $content);

it again display apostrophe instead of inverted comma.

I try to replace apostrophe by comma using

str_replace("’", "'", $content);

It doesn't work. Any suggestions?


Samir Karmacharya February 2016

I have tried this one

<?php $content = get_the_content();
    $content = apply_filters( 'the_content', $content );
    $content = str_replace(']]>', ']]&gt;', $content);
    $content = html_entity_decode($content);//added extra code
    echo $content = str_replace("’", "'", $content);


$content = html_entity_decode($content);

this code then it works for me. But still didn't know why WordPress convert.

Post Status

Asked in February 2016
Viewed 1,466 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life