If you set the fields
argument to ids
in your query it will return only post IDs which you can then pass to other functions to fetch the data you need. Though that may save memory at the cost of increasing queries to the database.
Related Posts:
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- How to get ‘post_content’ without stripping tags?
- Should we trust the post globals?
- Get content from one page and show it on another page
- Removing any and all inline styles from the_content()
- Random sort within an already sorted query
- how to get a different html for odd/even posts?
- How to disable content pagination?
- Modify ‘Read more’ link adding a new class
- How to know if get_posts() failed?
- Adding a div class or id inside the_content()
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- WordPress Number of Posts Not Changing With posts_per_page
- I have over 4000 posts, will querying some of them cause performance issues?
- Duplicate posts
- Divide Post content into separate divs for every 500 characters (or any other character counts)
- Looping through posts per category gives same posts for each category
- How to show posts rank based on custom field value
- Post content being duplicated by the_content();
- How do I create Comma Separated list of attached image ids?
- How to add posts to wp_query result?
- Trying to put an array into ‘post__in’ => array() query not working
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- How can I extract the URL of a link from a post?
- How can I display a specific user’s first published post?
- Content editor creating blank paragraphs in spaces and creating   in the_excerpt
- Query All users that has post
- How to add custom content (text/image) at start of content (IN content ie the same line)
- wp_enqueue_media() slows down my WP site
- Check if almost 10 year old – working code is up to date
- Query to fetch custom taxonomy along with post title
- How to limit wordpress the_excerpt() dynamically
- How to fetch courses in all languages in WordPress?
- Query custom post type custom meta key
- how can i take wordpress post as embed?
- Ignore posts content in the posts queries for internal linking
- How to search through “post title” and “tags” using WP_Query?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- I have two post types in the same query, how can I use CSS to select only one post type?
- filter posts based on menu_order
- Bulk Post update_post_meta
- Count posts for pagination
- Show 5 posts and than 3 posts offset with pagination
- AJAX load more posts not using correct category and repeating the same few posts
- I need some explanation on global $post [duplicate]
- How to delete all posts with dead image urls?
- Numbering author posts in posts query
- if CPT content is empty then
- How to run select query of post with category and tags?
- Querying posts from current category, using a variable as array argument
- Find post tags words in post content and link them to tag URLs
- Query posts from newest category
- Sort Events by Venue Title – Sort Post set by related post ids
- wp query custom orderby not custom field
- Add review box by function at top or bottom of content
- Query post for today, if no post get the previous one
- Custom Select Query pagination not working properly
- Query post by meta key of another table
- Sort / Filter Queries
- Query post category & remove any post id
- Add Image Before Posts Entry Title
- Display the latest post from some selected authors
- Showing content from WordPress ruins page CSS using WP_Query, without, content does not show
- Advanced Post Display/Pagination/Ordering
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Grab next post title in archive page
- Removing a post from the results of a WP Query
- Query posts from a specific category and selected tag
- Continuous listing from a custom field
- Displaying Results From Custom Taxonomy Query
- Sort post by category using HTML Select tag
- How to store post rating system data post independent?
- Get first comment link on the post itself
- WP_Query retrieve custom posts but not the post showing
- Special Query: Title, Terms, Content – %LIKE%
- Creating pages and getting their values from the database table
- Make division in post_query?
- How to limit post query to only return a total count of items with certain post statuses?
- Assign custom class to post content images
- the_content() not displaying the full post
- Display one post randomly from category on home page
- Stripping tag from elements in post
- How to set value in Query Loop?
- Wp_query WooCommerce products
- The page that displays Posts on homepage
- query_post or single-[cpt].php?
- How add class the_content();?
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Display posts with id equal to relationship value
- Sort Posts Alphabetically Based on Specific Category (Divi)
- Change permalinks in posts via SQL
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Batch Scanning and Deleting Empty WordPress Posts
- Add a category to posts, that DO NOT contain two specific keywords?
- How to make WP_Query faster when getting a post from one year ago?