Site icon Hip-Hop Website Design and Development

Fill the exclude array() in get_posts()

I’m using this code to populate the dropdown menu in a meta box.

        $parents = get_posts(
           array(
           'post_type'   => 'jhk_story', 
           'orderby'     => 'ID', 
           'order'       => 'ASC', 
           'numberposts' => -1,
           'exclude'     => array(121, 131, 138),
           )
        );

This post_type contains the parents of a post_type ‘jhk_frames’, which are the only child. So, the children contain in their post_parent field the post_ID of their parent. The parent contains in their post_parent field still the default zero.

My question is: how do I select only the posts in the post_type ‘jhk_story’ that have a child?

Next step is to put the id’s of these posts in the ‘exclude’ array.
The values you see right now are put there by me, just for example (and a check that is works).

Any help will be appreciated greatly.