If you want to query for a large set of posts, but don’t need full information for each you can use 'fields' => 'ids'
m see Return Fields Parameter.
In this case, I concur with comment, it might make more sense to simply retrieve adjacent post several times. You’ll have to use setup_postdata()
and wp_reset_postdata()
since get_adjacent_post()
doesn’t allow you to set post explicitly. Unfortunately that function isn’t too friendly to reuse or make use of SQL it generates.
Related Posts:
- Need help with get_posts pagination
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- How do I get posts by multiple post ID’s?
- What does setup_postdata ($post ) do?
- Query for custom post type? [closed]
- setup_postdata() does not seem to be working?
- Regenerate Slugs From Title of Posts
- get_posts – get all posts by author id
- Why get_posts are only showing five posts (retrieved by assigning a category to them?
- Exclude Current Post from Recent Posts Loop
- WordPress get_posts by category
- is it possible to get next_post_link
- get_post random and order by not working
- Get Previous & Next posts by Post ID
- Filter next_post_link() and previous_post_link() by meta_key?
- Alternative to get_posts() due to multithreading cache crash
- How can I add title attributes to next and previous post link functions?
- How to get current post ID in quick edit callback
- get_posts with meta_compare=’LIKE’ not working
- How to get next and previous post links, alphabetically by title, across post types, in a shortcode
- get_adjacent_post alternative on a very large db
- How to restore deleted pages/posts?
- Sort “get_pages” by menu order not ordering
- get posts based on meta value of the author
- date_query not returning some posts in date range
- Get the exact SQL query that get_posts() generated
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- next and previous post link ordered alphabetically
- How do you get posts by meta_query using the JSON API plugin?
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- Why favour the standard WP loop over iterating over (new WP_Query())->get_posts()?
- Query posts ordering by title, but ignore ” and special characters
- How can I limit the length of the previous/next posts in my WordPress Theme?
- How to use next_post_link and previous_post_link on single posts in search results
- Next/Previous Posts Links: Alphabetically and from Same Category
- get_posts inside cron
- How can I get next post id after current post id for custom post type
- Problem excluding category from get_next_post
- Why is previous_post_link and next_post_link working outside of the Loop?
- How to show next Post Thumbnail image in WordPress using current post id
- adding custom fields to next and previous post link
- get_posts not honoring post_status
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- get_posts returning empty array
- Using previous_post_link and next_post_link to wrap around post sequence
- Disable “previous link” in first post and “next link” in last post
- previous / next post with thumbnail
- get_posts only children from certain parents
- Problem with get_posts, tax_query and counting the number of posts
- get_posts cannot grab from specific category
- next_posts_link not working in custom loop
- Making next_posts_link(); return posts by month
- Filtering custom post type query
- Show prev and next post links for parent post of current image in attachment page?
- WordPress previous_post_link exclude posts with multiple categories
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Showing Thumbnail from Previous and Next Posts
- Next and prev. post link ONLY within category
- Check If posts exist in custom post type category, outside of loop
- data returned from get_post($postId) have different keys than wp-json/wp/v2/posts/{postId}
- How to limit get_posts()?
- Working with Next and Prev links in Single Taxonomy Templates
- How to make my pagination loop continuously?
- meta_query date and time comparisons
- get_posts from post x(offset=>x) to end
- With get_posts(), how can I put a category as a variable
- What’s the difference between “get_posts” and “wp_get_recent_posts” when used with “setup_postdata”?
- Serialized array, grab specific posts with meta_key/meta_value[0]->is_featured
- Previous/Next Post Within the Category?
- How do I combine these 2 queries
- get_posts gives different result than wpdb->get_results
- Increase the page size of the WordPress REST API
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- How to generate a list of posts published on current day?
- Next and Previous links on a single taxonomy page only link to same term
- Get attachment next and previous by author only
- connect last post with first post
- Trouble using get_post
- Cache Get_posts
- Get latest posts from multiple categories
- get_posts() returns all posts rather than the ones specified with ‘post_author’ =>
- previous_post_link() next_post_link() arrow position
- Query random post from different categories
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Get_Posts, only if in both categories
- Posts not showing in correct Alphabetical or ID order when using get_posts / orderby but only on production server
- get_posts() excluding all children of a specific post/page
- Secondary Query Is Breaking Main Query
- If clauses in get_posts query
- var_dump and print_r cause white screen
- `get_posts()` ignore my custom post
- Can I use get_adjacent_post for specific categories?
- excluding current post from get_posts
- Add #anchor to next/previous_post_link
- How to query posts to include specific pages of one post type, and all pages of another post type?
- Next and/or previous post content
- Only retrieve posts where post_excerpt has been filled out
- Can I use numberposts=-1 and offset together when using get_posts()?
- Ordering posts in get_posts
- I don’t arrive to do order_by title when i have a conditionnal year in a request