The post_parent
arg to WP_Query
can be set to 0 to only return top-level entries.
https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters
Related Posts:
- WordPress category & taxonomy loop with pagination
- have_posts() return false but count says “3”
- Get posts that matches specific terms of multiple custom taxonomies
- Filtering posts by multiple taxonomies
- Using get_term() in functions.php results in Invalid taxonomy error
- How can I modify the loop from a plugin without wiping out other filters?
- How to return only one instance of each, from the entire loop
- Displaying terms based on loop posts?
- I write simple wordpress loop for taxonomy.php file but don’t show result
- Distribute Gallery Images Every nth in Loop
- Trying to get property of non-object in shortocde
- Display name of taxonomy once
- Get most recent post for every term in a given taxonomy type
- How to use this $tax_selection variable in this custom loop?
- Avoid WP_Query’s duplicate posts with taxonomies
- Use ACF Category Image for all Taxonomy Archive Views
- Loop shows post 5 times in a query
- Attachment Metadata inside of Loop
- Creating a archive for taxonomy terms, not the term results
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- How to get Author ID outside the loop
- remove tags from the_content
- the_title() shows title of the first post instead of the page title?
- Why do themes rely on “The Loop”?
- What exactly defines a Main Loop and a Secondary Loop?
- Loop code is displaying pages but not actual posts
- How are both HTTP and HTTPS versions displaying?
- post loop causes wp_users and wp_usermeta DB queries for each users
- Ajax loop refresh on click
- the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”
- Is get_posts() more efficient than The Loop?
- loop through all posts memory error
- Creating a multi-taxonomy query, excluding the newest (read: highest ID) taxonomy term
- Targeting a Certain Post in Loop (CSS)
- Get post/page data outside the loop
- Display most viewed post from last 30 days is not working correctly
- What is the maximum number of posts a WordPress loop can work with?
- Split loop to load WordPress gallery into Bootstrap modal and carousel
- Trouble Formatting DateTime
- Order archive results by post id in custom taxonomy template
- pre_get_posts for two loops on same page
- Modify the main loop to display current month / year
- Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages
- Basic multiple loops only displaying first loop
- Problem with displaying HTML content after in_array [closed]
- Both a page loop and posts loop on the same page
- Get author_id in wordpress
- Single.php different behaviour from admin to non-admin
- WordPress Blog has an infinite redirect loop
- Stepping through a foreach loop – adding +1 to the end of it so next time it loops it starts on item 2
- Can’t access PHP array inside script localization from javascript
- ACF – add a group inside a repeater [closed]
- How to create bootstrap grid loop?
- Is it possible to reverse the order of a list of posts pulled from a loop?
- Get post offset/posts page offset in single post page (outside the loop)
- First article : single column; Other articles : 2 columns
- How can I access specific posts brought back by query_posts?
- Put multiple custom loops on same page
- Contact information footer
- Multisite foreach loop returning only one result
- Content Visibility for WordPress is not working (Drafts, public etc.)
- Loop is crazy – one row displays wrong count of posts [closed]
- Generating a perfect loop
- I need to display all post in onepage
- WordPress loop not working only on home page, works on all other pages
- Exclude category from get_the_category
- Video post format, extra content breaks video embed
- Why is my category post repeating twice
- Adding a featured image to a foreach WordPress loop
- Hook to main query with filters based on custom fields
- Using has_tag() outside loop
- Related terms – Terms that feature in post of current term
- How to create multiple loop in archive page?
- Offset for Loop
- How can I change how my tag pages display?
- Get a Post Loop based on Logged in User information into a Shortcode
- Loop keeps showing the same post even when I click on a different one
- Query users and count totals based on meta values
- php loop error for count posts in category
- Display all the terms within a custom taxonomy
- Submit form for loop of products of the term with AJAX
- Customizer settings using “for” loop
- Deeply Nested Menu Loop with Twig using Timber [closed]
- WordPress redundant posts based on meta field
- WordPress with woocommerce custom query
- Get featured image outside the loop using foreach
- Page gets displayed in post field
- Display Taxonomies in loop with template args
- pre_get_posts main_query not displaying after applying tax_query filters
- setup_postdata in “loop-handling” php file called via $.ajax
- Secondary loop cuts off at 10 posts?
- Same Loop on Multiple Pages
- get all page templates
- strange parse error when including a loop template within another template
- Previous Posts Link and Next Posts Link Show All The Same Articles?
- Posts Loops To Display Specific Posts Inside Page Template?
- Use callback function in AJAX pure javascript [closed]
- Undefined variable: woocommerce_loop [closed]
- title not being printed within html tag [closed]
- Hook in the loop after the first post