DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

If you use pages and subpages or posts and parent posts on your WordPress blog, it should be a good idea to display parent page/post title while on a child page. Here’s a code to do that job easily.

To achieve this recipe, simply edit your page.php file and paste the following code where you’d like your parent page title to be displayed:

$parent_title = get_the_title($post->post_parent);
echo $parent_title;

That’s all. Also, this code should be some inspiration for creating breadcrumbs. See you tomorrow!



  1. Pretty awesome thanks for the help

    Cheers :)

  2. Thank you!

    I had some code that worked but when there were parent pages with two words it place a hyphen between them. This is much cleaner and no hyphen! 😉

  3. Thank you very mach,

    very simple and clean code

  4. Thank you :-)

    An if-function would also be helpful

  5. Doesnt work if you have more than 2 level.

    Page 1 -> Page A -> Page Level 3 -> Sub Page (level 4).

Leave a Comment

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