Use get_the_title(), not $post->post_title

WordPress lesson of the day:

If you want the title of a WordPress post, use the function get_the_title($post->ID) and not $post->post_title.

Both should work, but I found when you use smart or curly quotes (both single and double) in your post titles, using $post->post_title returns an empty string. Perhaps running a filter function would help, but I have no reason to go through that trouble right now.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *