The posts query is not recursive by nature. And I don’t think that post_parent
accepts multiple IDs, so you will likely need to loop and run this for multiple pages or play with query filters to do this in less requests (if performance becomes an issue).
Related Posts:
- Broken? WP_Query and “attachment” as a post type
- Is it possible to query all posts that don’t have an attachment?
- How to paginate wordpress [gallery] shortcode?
- Exclude Child Posts from WP_Query
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- Getting attachments by meta value
- Count the number of images uploded on the website
- How to paginate attachments in a secondary query as gallery?
- How do I exclude all images from a wp_query?
- get images attached to post
- Get attached media only
- query attachments of parent page if attachments of current page are smaller than …
- List the 5 most recent child pages
- wp_query for displaying attachments with a tag
- Show selected images on top in Media Manager
- How can I query posts with newly uploaded images?
- Sorting By Custom Posts With Attachments
- Attachment changing page’s permalink – $post not resetting?
- Set order of returned items in the WP_Query() class/function
- How to fetch only media that was already attached to a post/page?
- How to do meta_query for attachments?
- Get attachment by meta_key value
- How to show optimized list of posts with all their attachment images
- Where to put meta Keys
- WP_Query Attachment adds additional attachment count and need to link attachment to post url
- Better wordpress attachment query than this
- Why having more than 10 clauses in WP_Query results in some outputs being dropped?
- wp_query get attachments in larger size
- Creating attachments archive in tags and categories
- Ignore image urls in wp_query search
- Don’t repeat posts from children in parent taxonomy query
- WP_Query: attachment image in “full” size?
- How to make a query returning pages from multiple parents
- get all images from the wordpress media library with link to the post they are associated with
- How to restrict add media library only to images of the same post family?
- how to get custom attachment url?
- WP_Query doesn’t works inside loop
- wp_get_attachment_image not to get the post_thumbnaill
- Query All Attachments and Order by Parent Publish Date
- How To Query All Attachment Images Found In Post Galleries
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- Using WP_Query to get attachment returns empty set
- Some images not being returned with wp_get_attachment_image
- Loop issues when creating custom query for media uploader
- query only direct child and sub-terms of a current term archive
- Give attachments an archive page, and exclude unattached ones
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
- Find out total number of pages in global query on archive page?
- Resetting post data to previous loop in nested loops
- Is it possible to completely stop WP_Query retrieving posts?
- Make loop display posts by alphabetical order
- Displaying several specific pages using WP_Query()
- WP-CLI How to generate a list of posts with corresponding meta values
- Query to return maximum of one post per author
- Get attachment by slug
- Warning: urlencode() expects parameter 1 to be string, array given
- Group posts by custom field
- How to get the posts published in last two days using WP_Query?
- getting posts and number by specific meta value in multiple meta
- Can not switch the queried post in pre_get_posts hook
- how to fire join query with post_meta
- Pagination problem after WP_Query with tag filtering
- Custom Loop in Page Admin Causing Other Fields to Fail
- Pagination stops at page 6
- How to limit total number of posts in wp query loop?
- Get list of terms that have posts in another term
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- WordPress add_rewrite_rule() cannot visit lower url levels
- Get a post from other loop each n-posts in the main loop
- Sort by price woocommerce by ID post_meta
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Why is WP_Query not displaying expected data?
- Filter post query to only show direct children of category
- Highlight current post title on a page
- Why won’t draft listings appear for non-admins?
- has_excerpt() not working inside wp_query
- Apply query arguments after the nth post
- How to properly use AND / OR in custom search
- Get every post with value in meta key
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- Searching by title, content and custom taxonomy
- Paging + WP Query
- Getting the permalink to the latest post from a category
- Query to get result by Title or Meta along with tax_query parameter
- Why are my wp_query args being ignored if post_type = CPT
- Woocommerce Get Orders By Meta Value
- WordPress Query optimaization for slow query
- WordPress – just refresh blog archive by new query
- how to move a page from one drop down menu to another drop down menu
- Meta query doesn’t remove placeholder escape before query
- Multiple values in WP_Query : category__and
- How to use wp_query in different column in single loop
- Paginated Post List on Front Page
- Show subscriber id in loop
- Website goes slow down after importing long database
- How to Query Updated Post in WordPress
- wordpress nested loop
- Query posts only shows 1
- First post outside of loop, homepage only?
- wp_query, calculate with two dates when ‘key’ is text format