I have several pages with a parent. So, $post->post_parent should be different than 0, right?
echo $post->post_parent;
Is returning 0.
Thing is, this is only happening in one post category. Do I need to declare that a page has a parent elsewhere? I do it from within the edit page form of that page.
Thanks!
Try echoing
serialized($post);
to make sure you’re looking at the right page(s). It should return the post_parent so the problem may be either in the call you’re making to get$post
, or double-check that the set of pages did save with a parent page.Easiest way of doing that is call up “All Pages” and they’ll be indented under the appropriate parent if they’re set up correctly (otherwise opening each one and looking).
yes. It should be different. For child the value will be 316.