WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to customize the header title of a page to include the menu label of the parent page.

I have this code that does essentially the same thing - but using the parent page title instead. Any ideas?

<h1 class="page-title"><strong><?php
    // If child page , also include the parent title:
    if ($post->post_parent) {
        $parent_title = get_the_title($post->post_parent);
        echo '<span>'.$parent_title.' &#8212; </span><br />';
    the_title(); ?></strong></h1>

enter image description here

share|improve this question
What's the "menu label" of a page? – gmazzap Dec 13 '13 at 16:23
What's wrong with the code you posted? What have you tried to debug that? – Howdy_McGee Dec 13 '13 at 16:23
There is nothing wrong with the code above - but it uses the "Title" as defined in the page. I'd like to use the text used as the navigation label instead - defined for this page in the menu settings. – Anders Carlén Dec 13 '13 at 17:10
Apologies for the possible confusion: I just checked and saw that in WP 3.8 the term used is navigation label and not menu label. – Anders Carlén Dec 13 '13 at 17:11
I don't believe that is part of WordPress, quick google search looks like it is part of the All in One SEO pack plugin. You can probably grab that label and title from post meta, but you'll have to find out what the meta names are (if you inspect the input elements, I bet the names are the same as the post meta name). After you get the name you can retrieve the label with $label = get_post_meta( $post->post_parent, 'seo_pack_label', true );. Note the seo_pack_label needs to be changed, I made that up. – RadGH Dec 13 '13 at 17:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.