admin管理员组

文章数量:1432643

I use the free-blog theme and I have created a menue:

Home
  page A
  page B
      Child page A
      Child page B
      Child page C
  Page C
      Child Post A
      Child Post B

Now I want to create a bread crump. like_ Home-> Page B -> Child page A

So far this is not so difficult. I can get the Child Page Id without problems but I can't get the parent page ID. It is always 0.

I tried it with

$post_id = get_queried_object_id();
$post    = get_post( $post_id );
$parent_link = get_permalink($post->post_parent); 
$parent_title = get_the_title($post->post_parent);

$post->post_parent is always 0

then I tried

$parents = get_post_ancestors( post_id );

but the parents count is 0 too. The same with

 wp_get_post_parent_id

So I wonder if I do something wrong when I created my menue. In the Child Post A I tried to select the category, but the parent value is still 0

本文标签: breadcrumbCan39t get parent page id