I am trying to get the the my posts title in my single.php in an unencoded format. I have tried using
html_entity_decode(the_title()); however all still encode characters like &.
Can someone tell me what the correct syntax is to use?
Get the current
WP_Post object using
get_post(). Then access the
title property of the
WP_Post object instance. This gives you the raw title value as entered via the WP Dashboard.
<?php $post = get_post(); $raw_title = $post->post_title;