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
版权声明:本文标题:breadcrumb - Can't get parent page id 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745544410a2662639.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论