Title: Exclude child posts or specific posts
Last modified: April 30, 2024

---

# Exclude child posts or specific posts

 *  [km](https://wordpress.org/support/users/kmaisch/)
 * (@kmaisch)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/exclude-child-posts-or-specific-posts/)
 * Hi Ryan,
 * Great plugin! I’m wondering if there is a way (perhaps using the custom meta 
   queries) to automatically exclude child posts from the loop?
 * I tried using post_parent = 0 – but I don’t think that’s a meta key.
 * Alternatively (feature request), it would be great if there was an “Exclude Posts”
   option, similar to your “Include Posts” option.
 * For now I’m using “Include Posts” and manually selecting the relevant ones – 
   but being able to exclude the child posts will mean no need to update the query
   loop each time posts are added.
 * Cheers,
   Kim

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

 *  Plugin Author [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/exclude-child-posts-or-specific-posts/#post-17724187)
 * This is a feature that has been requested and my only concern is that this can
   be a very expensive query to make and if used incorrectly has the potential to
   slow a site down or even crash it.
 *  Thread Starter [km](https://wordpress.org/support/users/kmaisch/)
 * (@kmaisch)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/exclude-child-posts-or-specific-posts/#post-17737158)
 * Thanks Ryan, what if it applied a class to the items in the loop, such as “is_child”,
   or “postid_123”. And then the exclude setting simply set display:none to those
   classes, depending on whether “Exclude children” or a “Hide posts from loop by
   ID” setting was used?
 * (not sure if that would be less resource intensive?)
 *  Plugin Author [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [2 years ago](https://wordpress.org/support/topic/exclude-child-posts-or-specific-posts/#post-17751565)
 * The potential issue would occur at the point that we make the request from the
   database. Once we have the posts then the can be displayed normally. I may be
   overthinking the risk here but there are so many different server configurations
   out there that its very hard to know what the acceptable level of risk is to 
   allow users to great even more expensive queries. That’s not a “No”, I just want
   to consider it
 * All that being said, there is a[ pull request](https://github.com/ryanwelcher/advanced-query-loop/pull/32)
   for this feature that I am reviewing currently

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

The topic ‘Exclude child posts or specific posts’ is closed to new replies.

 * ![](https://ps.w.org/advanced-query-loop/assets/icon-256x256.png?rev=3106826)
 * [Advanced Query Loop](https://wordpress.org/plugins/advanced-query-loop/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-query-loop/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-query-loop/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-query-loop/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-query-loop/reviews/)

## Tags

 * [exclude posts](https://wordpress.org/support/topic-tag/exclude-posts/)

 * 3 replies
 * 2 participants
 * Last reply from: [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/exclude-child-posts-or-specific-posts/#post-17751565)
 * Status: not resolved