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)
- Print Current Post Index number within Loop
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- How to show list of posts by author and category?
- Getting the Next and Previous Posts Titles in the Sidebar?
- How to display posts by current user/author in a custom page template?
- WordPress Number of Posts Not Changing With posts_per_page
- Setting pagination for images attached to a post
- Find most recent authors
- Query only Posts from Both of Two Category?
- Strange switch_to_blog() issue
- Multiple loops in same page, without duplicate content
- 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)?
- Post Navigation
- Converting multiple loops into one single loop with pagination
- How would I get 1 latest post from a query for 5 posts?
- setup_postdata doesn`t seem ot be working
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- Automatically republish old posts
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Alternate row and columns every X posts
- Adding specific post category between posts in loop
- Multiple loops are not reset
- Exclude category from
- How to exclude latest x posts from a paginated query?
- Posts will not display on page-mypage.php
- Pausing and Resuming WP_Query results
- How to : pagination in 3 different custom loops on the same page
- Sharing post from archive page (loop) doesn’t work
- Highlight static blog page link in header
- Show posts count for Categories and Tags in wp_nav_menu
- How to get posts and comments amount per hour, per year and per month?
- How to Get Posts, Including Private Ones?
- Change all author links in Blog roll
- Random posts from a pool of posts
- Showing categories and subcategories with posts
- Conditional Tag for has post [closed]
- older blog posts not showing in new theme
- WordPress Query Posts From Category Post on Static Page
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- WP_Query: Show 10 posts in date order, first three random
- How include css class based on post ( in loop ) slug?
- WordPress Loop: How to display recent posts in multiple divs
- How to get post with slug and exclude categories
- Cannot implement byline into posts container in single.php
- How to check if there are posts with the same tag
- linking to post outside the loop
- WP_Query of Category Not Showing First Post
- How come this loop is not working? [closed]
- Add Text Domain To Post Navigation
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Using the loop to set locations for all posts on a single google map
- How to show next/prev link, when it’s not active?
- Defining ‘last’ class on foreach blog posts
- How to add content above footer in posts from specific category
- Want to change the post every three days with in specific category
- Separate top level categories on archive-product.php by meta
- While loop in functions.php outputting the_title() of each post on frontpage
- Shortcode for Comments and Comment Boxes in Post Loop
- Permalink Short code showing unnecessary link text inside the loop
- REST API Working for GET but not for POST?
- How can I get the last post while on the first post for pagination? As if it were infinite
- Fill the exclude array() in get_posts()
- Double loop output
- post->ID displays the same ID number for every post
- Posts are not showing up on next page.
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- Post are not showing up
- How to make post button to a random post
- Advanced Post Display/Pagination/Ordering
- How to get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- How to get single post by one author?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- How do I create a template page to show 3 blog posts?
- How can I get the first post THIS SAME CATEGORY?
- wordpress show category link instead of post link [closed]
- blog post displaying within older post – loop issue?
- Show a page counter for pagination