The problem was that WordPress uses these functions based on post_date
…
I did an import from an old CMS to WordPress where I just added all posts within a loop. Some of the dates were a few seconds off. This caused the functions to return ‘false’ posts.
I actually wrote a custom class that handles getNext()
and getPrevious()
with a combined function called getSiblings()
based on post_id
.
I actually wrote a class that fully tackles this problem. Check github for the full code. Contribution would be very much appreciated 🙂
Related Posts:
- get comments and get posts in loop
- Inserting custom data to the_post() during loop
- How do I restart my loop with get_next_post()?
- Post Loop Missing Most Recent Post
- Pagination with an array of post objects?
- get_next_post() not working with future post status
- How to add navigation arrows to manually slide through posts?
- Can the_post_navigation() be outside of the loop?
- How to get all posts in gallery post format template
- How do I paginate posts page with $wpdb?
- Displaying posts on Homepage
- posts_per_page – Repeats only first posts ‘post__in’ array
- View post with specific category id and name which I selected in the backend (drop-down option)
- Get Posts Under Custom Taxonomy
- Print Current Post Index number within Loop
- Should we trust the post globals?
- How to get posts published between a date and today?
- How to show related posts by category
- How set featured posts using checkbox in post edit screen?
- get_children() Not Working with orderby Parameter
- Get first post from wp_query
- How to get all posts related to particular category name?
- get all posts ID from a category
- Do we still need to include a “if (have_posts())” in templates?
- WP_Query: Why is sticky post not first item in loop?
- Query *only* sticky posts
- Display all posts from specific categories on a page
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- How to show list of posts by author and category?
- Override the default number of posts to show for a single loop?
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Getting the Next and Previous Posts Titles in the Sidebar?
- How to know if get_posts() failed?
- Display content from a specific category
- How to display posts by current user/author in a custom page template?
- Reverse chronology of post listing
- Why do I need to use The Loop on pages (inside page.php etc)?
- How to get previous 10 days post from a specific date – WP Query
- the_post_navigation seems to ignore same category filter
- posts page – different lengths of excerpt
- WordPress Number of Posts Not Changing With posts_per_page
- Adding Post Counts to Menu (Nav) Programmatically?
- how to display full post with pagination on home page
- Count singular post views automatically
- Show the title of the latest post by author
- Looping through posts per category gives same posts for each category
- Setting pagination for images attached to a post
- Find most recent authors
- Query only Posts from Both of Two Category?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Display All Sticky Post Before Regular Post
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Get the author of the latest revision
- is there a better way of combining this?
- How to have different content in the loop and single
- Specific loop in Shortcode
- Navigation link to specific user page
- Strange switch_to_blog() issue
- Show a list of recently viewed posts to a user
- Multiple loops in same page, without duplicate content
- loop not displaying posts on custom template page
- Repost post on specific date every year
- How to use alternate post layout at key points in post loop?
- Alternate custom content in the loop
- Showing random content / pictures from earlier posts in a sticky post?
- Search widget breaks when using multiple loops?
- WordPress get posts by date without query_posts
- How to Display Post View Count
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- Display Latest Post from all Categories
- Auto Refresh Post List after X seconds
- The correct way to call posts with ajax
- Post Navigation
- custom wordpress post loop – hide iframe content
- Double count view in archive.php
- Divide Loop Into Days & Categories
- Posts are not showing up on particular category
- Converting multiple loops into one single loop with pagination
- Display posts with comments closed, with pagination?
- get selected post using $_GET
- Group posts by year in loop
- How Can i Get 5 Recent Post Title With Corresponding Link?
- How would I get 1 latest post from a query for 5 posts?
- Can I set and show “important” post in my blog?
- setup_postdata doesn`t seem ot be working
- While in “the loop”, detect if a post is the most recent
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Different style for most recent article
- Contact form 7 post loop [closed]
- Differentiate between posts and pages in search results
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- Encrypt / Decrypt Post Title and Details
- Get Posts via Taxonomy Term Name with Space
- Loop through all product posts?
- Get specific posts by ID in wordpress
- How to display different number of posts