20

My page ID is: 30601.

I want to get the page's title with ID.

0

2 Answers 2

42

Try with this:

<?php echo get_the_title( $ID ); ?>
0
3
<?php 
echo get_the_title( get_the_ID() );
?>

get_the_title fetch the title of WordPress post based on particular Id. and get_the_ID() fetch id of that page/post

2
  • Hi, Anurag Tiwari. Thanks for contributing to WP Stack Exchange. Just as a friendly suggestion to make your answers a little bit more compreensive, I encourage you give some context or explanation and/or references to the function in documentation. Commented Feb 22, 2020 at 21:38
  • Thanks for the suggestion. Next Time I will do the same Commented Feb 24, 2020 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.