bobbingwide / sb-children-block

List children of the current content as links.
2 stars 0 forks source link

Children block only works for the 'page' hierarchical post type #13

Closed bobbingwide closed 4 years ago

bobbingwide commented 4 years ago

When I tried to use the sb-children-block to list the variations of my block CPT nothing was returned. I'd assumed that the logic using child_of would not require the post_type parameter. But that assumption was wrong. The logic needs to find the post_type of the selected parent post ( $post ) and pass that on the call to wp_list_pages.

bobbingwide commented 4 years ago

There is another assumption that I should point out. While wp_list_pages does appear to support multiple post types, by passing the post type of the parent post we're limiting ourselves to only finding posts of that type.

Therefore this block will not work where the post hierarchy allows different different post types in the parent-child hierarchy.

Note: I've never worked on a WordPress site where child posts can have a different post type from their parent.