• Hello, I’ve read that it is possible to retrieve the link to the parent page with
    echo '<a href="'.get_permalink($post->post_parent).'">'.get_the_title($post->post_parent).'</a>';

    But is it possible to retrive the parent page ID or slug ?

    Thanks !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Sure. You already know how: $post->post_parent is the parent’s ID number.

    Here is the parent page ID
    $post->post_parent

    Here is the Parent page Title
    $post_id_7 = get_post($parentpageid);
    $parentpagetitle = $post_id_7->post_title;

    Here is the parent page link
    get_permalink($parentpageid)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get parent page ID (or slug)’ is closed to new replies.