How do I get the Post Title from his ID in WordPress?

I’m trying to get the title from post ID but outside the loop. I have something like this:

<a href="<?php echo get_permalink($ID) ?>"><?php echo $ID; ?></a>

and now inside the a element I have only ID (with working link to the post). What should I do to get the title instead ID?

Thanks

Read more here: How do I get the Post Title from his ID in WordPress?

Leave a Reply

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