My page ID is: 30601.

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


Try with this:

<?php echo get_the_title( $ID ); ?>
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

  • 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. – Celso Bessa Feb 22 '20 at 21:38
  • Thanks for the suggestion. Next Time I will do the same – Anurag Tiwari Feb 24 '20 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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