I’ve found the error in my nested if statements which was causing the infinite redirect loop – I failed to check if we were already on the first post before redirecting to the first post in the category. Duh!? It really had nothing to do with how I was using get_posts or wp_redirect…
Need more coffee >-(
Related Posts:
- Get Posts Under Custom Taxonomy
- How to show related posts by category
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- get all posts ID from a category
- get comments and get posts in loop
- How to know if get_posts() failed?
- How to display posts by current user/author in a custom page template?
- How to get previous 10 days post from a specific date – WP Query
- Show the title of the latest post by author
- Setting pagination for images attached to a post
- Query only Posts from Both of Two Category?
- is there a better way of combining this?
- WordPress get posts by date without query_posts
- Posts are not showing up on particular category
- get selected post using $_GET
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Can I set and show “important” post in my blog?
- setup_postdata doesn`t seem ot be working
- Encrypt / Decrypt Post Title and Details
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- Automatically republish old posts
- get_next_post() and get_previous_post() return wrong posts
- Get posts by name and taxonomy term
- Inserting custom data to the_post() during loop
- How do I restart my loop with get_next_post()?
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- Why is querying posts messing up my pages?
- get_the_content(“more…”) returns full text
- Insert Content In Between Post Feed
- Post Loop Missing Most Recent Post
- Get Posts Under Custom Taxonomy
- Include sticky posts on the static page front page
- Get attachments for posts that belongs to a specific category
- Pagination with an array of post objects?
- Any way for get_next_post() to use the actual post order instead of publish order?
- Posts loop displaying the same post data
- How to get posts from a current post’s month?
- How to get posts and comments amount per hour, per year and per month?
- While loop articles – if statement order
- Count number of posts of current month
- How to Get Posts, Including Private Ones?
- Random posts from a pool of posts
- Conditional Tag for has post [closed]
- How to get post content from an array of ids?
- Display Posts with template on a Page
- Number of displayed posts
- Why posts array is empty?
- How to create a “latest news” page showing a list of posts from blog category
- Post Filtering by GET URL parameters
- How to give classname to post if post has no content?
- Custom Articles page only showing a limited number of posts per page
- Related Posts function not working
- How to get post with slug and exclude categories
- get_posts not pulling the correct number of posts
- Get x recent posts by author?
- If post does not exist, do something
- List latest posts with least comments in WP-Admin
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Get posts from current category?
- How to add content above footer in posts from specific category
- How to show multiple posts thumbnail, title and date in widget
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- Show only posts with titles/permalinks that do not contain certain words
- How to merge the content of posts that have the same title?
- How to add first 3-4 post tags on WordPress Post Title
- get posts, run a custom query, and join the results
- How to mark only one post as Featured post?
- get_next_post() not working with future post status
- Extracting the permalink from a post instance
- REST API Working for GET but not for POST?
- Fill the exclude array() in get_posts()
- Posts page listing pages as well
- WP_Query to get posts in a specific tag or has post_format
- How to Get Position of a Post from a category and tag
- How to add navigation arrows to manually slide through posts?
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- How to get all posts in gallery post format template
- Any difference betweenn posts and pages for one page?
- How to get the current user post and it’s ID?
- Retrieve latest post by multiple categories with ID
- External link not showing on post but showing on comment
- How do I paginate posts page with $wpdb?
- How to get all post titles starting with numbers and symbols?
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- Displaying posts on Homepage
- How to get single post by one author?
- Load posts from external source if not found in database
- get_posts includes “auto drafts”?
- wordpress show category link instead of post link [closed]
- posts_per_page – Repeats only first posts ‘post__in’ array
- append $_GET parameters to post
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Word count for all posts of all authors
- View post with specific category id and name which I selected in the backend (drop-down option)
- Translation related post text to Arabic
- Post/Page Publish/Update button not clickable once I make an edit