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
- How do I get posts by multiple post ID’s?
- What does setup_postdata ($post ) do?
- Query for custom post type? [closed]
- Why get_posts are only showing five posts (retrieved by assigning a category to them?
- Exclude Current Post from Recent Posts Loop
- 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
- How to restore deleted pages/posts?
- 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?
- Why favour the standard WP loop over iterating over (new WP_Query())->get_posts()?
- How to show next Post Thumbnail image in WordPress using current post id
- get_posts not honoring post_status
- get_posts cannot grab from specific category
- Making next_posts_link(); return posts by month
- WordPress previous_post_link exclude posts with multiple categories
- Showing Thumbnail from Previous and Next Posts
- 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
- Next and Previous links on a single taxonomy page only link to same term
- connect last post with first post
- Trouble using get_post
- Cache Get_posts
- “next_posts_link” and “previous_posts_link” display me NOTHING
- `get_posts()` ignore my custom post
- Can I use get_adjacent_post for specific categories?
- Add #anchor to next/previous_post_link
- I don’t arrive to do order_by title when i have a conditionnal year in a request
- Is it possible to nest get_previous_post()?
- Is it possible to skip certain specified pages when using < prev and next > links?
- Better way to list links with different meta values using same meta key?
- previous/next_post_link in the same sub-category?
- get_adjacent_post – in same term or category not working
- How to get the post content from a category on my homepage
- get_posts() not working in functions.php
- get_next_post_link() and get_previous_post_link() return wrong posts
- Display post details by post ID
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- What is the p parameter in a get_posts() parameter array?
- WordPress next/prev links Issue
- next_post_link / previous_post_link not working with WP_Query
- Inserting post content into pages when using custom taxonomies
- Displaying the author of next and previous posts in pagination?
- Query get_posts by level depth
- Get posts in between specific ID’s
- Single.php Category Post Count
- How to use WordPress Conditional Tags in get_posts foreach loop
- Why are previous_post_link/next_post_link skipping some posts?
- Don’t submit post if post title exists
- Hide gravity forms
- Why would get_posts be ignoring posts with 2-digit ids?
- Order custom post type by custom field (created by PODS) via PHP
- WordPress post pagination continuous [duplicate]
- get_posts returns all posts
- Get previous/next post from (specific) category
- WordPress post next/prev not working
- WordPress Random post (last 3 days posts)
- altering %title
- Tweak next_post_link for it to include thumbnail
- Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )
- Get all posts with a certain meta key, except for one with specific title
- Can’t get Category link inside get_posts
- List all pages including archive
- Yet another get_posts() in explicitly defined order problem
- List random posts on single page in the current category
- Next Prev Post link rendering current post thumbnail
- WP_Query and pagination AGAIN?
- Paging result of get_posts in function
- Next/Previous Product with custom order by price & products inside the product category [closed]
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Order by post_date does not work in Previous and Next post pagination
- Infinite next / prev post in single.php page
- How to exclude posts by meta key value in the_post_navigation next prev links?
- get_posts returning empty array
- Update all WordPress posts’s title and content then display them in a table
- Using previous_post_link next_post_link but with a filter on a custom field
- get_posts – check if custom field has content?
- Why does ‘meta_key’ return an empty array in get_pages
- Previous/Next custom post links within custom taxonomy
- How to know if the most recent article
- Get number of posts in each category since last visit
- Conditionally (cpt) filter previous and next_post_link
- Next/Previous Post Links in single-[custom-post-type].php file
- How to Retrieve Post ID of another page
- WordPress – List Sub Categories and Sub-Sub Categories, With Posts
- using next-page and previous page inside a wp_query
- How to show only 1 post from a specific category on the front-page
- Change next_post and previous_link to navigate throught parent categories only
- get posts based on category and post meta
- Retrieving next_post_link() and previous_post_link() in functions.php
- how to implement next/prev within category archive?
- How to show only text from post in WordPress
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query