Title: Loop through the current post&#039;s childrens
Last modified: August 20, 2016

---

# Loop through the current post's childrens

 *  Resolved [rooofl](https://wordpress.org/support/users/rooofl/)
 * (@rooofl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/)
 * Hello, each of my `customPost` possesses several `customChild`. I would like 
   to list all the childrens of a parent, on a dedicated page. I can’t access the
   the childrens of the current post using this. What did I do wrong? Maybe you 
   can help me?
 *     ```
       <?php
           $args = array(
               'post_type' => 'customChild',
               'post_status' => NULL,
               'post_parent' => $post->ID // this returns my 'customPost' ID
            );
           $revues = new WP_Query( $args );
           while ( $revues->have_posts() ) : $revues->the_post();
       ?>
       <div>
           <?php the_title() ?>
       </div>
       <?php endwhile;?>
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862408)
 * ‘post_status’ isn’t ever going to be NULL.
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters)
 *  Thread Starter [rooofl](https://wordpress.org/support/users/rooofl/)
 * (@rooofl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862411)
 * @s_ha_dum Oops you are right. The problem remains.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862416)
 * Are customPost and customChild different custom post types? If they are, how 
   did you set the one as the child of the other?
 *  Thread Starter [rooofl](https://wordpress.org/support/users/rooofl/)
 * (@rooofl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862422)
 * Yes they are different posts types. I use a [plugin](http://wp-types.com/documentation/user-guides/creating-post-type-relationships/)
   for the custom posts relationchip. Here is a [screenshot from my blog post edition page](http://cl.ly/0h142k2S093k1A421V2g).
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862426)
 * Then the question is “how does that plugin assign relationships”? Since your 
   code doesn’t work, it is likely that the ‘post_parent’ field is not used. I’d
   guess it is probably using custom fields so you’d need to use custom field parameters
   in your query.
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters)
 * But I’m guessing.
 * The plugin also has an API that might help.
 * [http://wp-types.com/documentation/](http://wp-types.com/documentation/)
 *  Thread Starter [rooofl](https://wordpress.org/support/users/rooofl/)
 * (@rooofl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862427)
 * Well, maybe I should chose a custom posts plugin with a standard behaviour. I
   would like to be able to use the default WordPress documentation for that. What
   do you think? Do you have any tips for plugins or do you think I should create
   my custom posts myself?
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862434)
 * If you are going to make one custom post type the child of another, ‘standard’
   would probably be to use custom field, which I speculate that plugin does.
 * You can nest custom posts though– ie. make one the child of another within the
   same post type–, just like you can nest pages. That doesn’t require a plugin 
   at all, you just need to set up the post type.
 *  Thread Starter [rooofl](https://wordpress.org/support/users/rooofl/)
 * (@rooofl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862461)
 * Ok, thank you for the tips, I will get rid of this plugin and try something else.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Loop through the current post's childrens’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [rooofl](https://wordpress.org/support/users/rooofl/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/loop-through-the-current-posts-childrens/#post-2862461)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
