Support » How-To and Troubleshooting » Get page->parent name?
4 years, 2 months 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;
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);.
$parent_title = get_the_title($page->post_parent);
@whit, thank you, that’s exactly what i wanted