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?


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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: