WordPress.org

Ready to get started?Download WordPress

Forums

Get page->parent name? (3 posts)

  1. nookaround
    Member
    Posted 2 years ago #

    Hi, can anyone please tell me how to get page->parent's name.
    I can only get it's id

    $page = get_queried_object();
    $pageparent = $page->post_parent;
  2. whit.skyler
    Member
    Posted 2 years ago #

    Hi nookaround,

    Yes, $page->post_parent is the page id.

    If all you want is the parent page's title, then you can do this:

    $parent_title = get_the_title($page->post_parent);.

    Whit

  3. nookaround
    Member
    Posted 2 years ago #

    @whit, thank you, that's exactly what i wanted

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags