Retrieving a post’s Title in WordPress without echo’ing

I’m currently looking for a way to find the Title of the current post/page you’re on, without it auto echoing the way that the_title(); does. Also, I don’t think get_the_title() is suitable as you’ll need to give that an ID (of the post/page) and I don’t think I can retrieve that without first using the ‘loop’?

Any advice would be much appreciated chaps!

Related posts

Leave a Reply

1 comment

  1. You should always have access to the current post/page’s ID. Normally it’s $post->ID globally. get_the_title() is definitely the solution you’re looking for.