To get the Title of the page normally we use the_title()/get_the_title() function. But in some cases, the page title may not display as expected. Instead of page details, it may display other contents ( for eg. its inner page/post contents). So, for avoiding such situations, just add the corresponding page ID along with the functions.
<?php
$id = '123';
<?php echo get_the_title( $id ); ?>
?>
From where did we get the page or post id ?
There are some methods to get the page/post id. But the easiest method to get the id is from its URL of Dashborad.
- Go to Dashboard
- Open corresponding page in editable mode.
- From the current URL, it is visible.
- eg. the post id of this post is ‘16911’
