If I have a post title like this: My new post - chapter 1
{{ get_the_title() }}
return My new post –
chapter 1
Does anyone have a solution for this issue, instead change to {!! get_the_title() !!}
?
If I have a post title like this: My new post - chapter 1
{{ get_the_title() }}
return My new post –
chapter 1
Does anyone have a solution for this issue, instead change to {!! get_the_title() !!}
?
Have you tried using {!! get_the_title() !!}
?
Yes, it’s worked. But how about security?
As the Blade docs state {!! !!}
displays unescaped data, so you are theoretically more vulnerable to a XSS attack. If that makes you uncomfortable, you have a few options:
get_the_title()
get_the_title()
Thanks @alwaysblank. I believe that the second option is the better.
A possible solution:
add_filter('the_title', function($title, $id = null){
return html_entity_decode($title);
});