The problem was with my code. I was using wp_reset_postdata() before a section that shows the post title, which made it look like the WP_Query wasn’t working. Here’s my code now (it’s a slider that shows latest posts, and the regular feed shows scheduled posts). I updated my question with my new code
Related Posts:
- pre_get_posts with get_posts
- How-to exclude terms from the main query the most performant way?
- “pre_get_posts” firing on every query
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- How to display future posts – modified query still yields 404
- Can’t get drafts with WP_Query using post_status parameter
- How to change posts order on Category and Tag archives?
- Show Sticky Post at the top but do not show again in the loop?
- Can I set my WP_Query to be a Main Query?
- WP Query – order posts by meta field first and then order the rest
- Can I alter the main loop to ‘orderby’ a custom callback?
- Some doubts about how the main query and the custom query works in this custom theme?
- Using a custom WP_Query with get_template_part loop
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- Loop within a loop?
- Display posts the match taxonomy term linked from wp_list_categoies?
- How to order posts tag by tag?
- SQL Statement generated by WP_Query not producing expected results
- Merging a complex query with post_rewind and splitting posts into two columns
- Pagination Not working on Home Page with 2 Query
- meta_query not working properly
- Exclude post on loop by multiple meta key value
- Sort by meta key on archive page
- Query sticky posts with thumbnails
- Show all parents and children in custom post type in right order
- Why is this coming back as null? Thats wrong. There is one post
- Searching through different categories on different pages code is not working
- Ignore post by meta value in the main query
- How to retrieve current page WP_Query arguments?
- How to limit WP_Query to one result on the loop?
- Multiple Loops Inside a Function
- Random loop with code to prevent duplicate output returns no output at all from time to time
- Single meta_query query using OR instead of AND in request’s WHERE statement
- How to choose between hooking into per_get_posts or into parse_query
- How to use offset in WP_Query
- new WP_Query to get max price meta value not working
- Multiple loops without repeating content
- WP_Query, pre_get_posts and offset
- wp_query ignoring custom post_status
- Change query based on post type while staying in loop
- Get a list of posts with associated meta_value
- hide custom post types with specific meta key ON admin backend
- $WP_Query: How to display excerpt on first post only
- Order ascending is ignored in meta query?
- How to make search for posts using get method?
- How to get list of posts from permalinks?
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- get_template_part causes 500 error
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- WP_Query – Adding “offset” posts to the end of the loop
- Conditional operator OR not working with custom fields
- Get posts that do not have the same tags as current
- queried_object using pre_get_posts gets notices and warning
- date_query in pre_get_posts out of memory
- wp_query is showing posts from other categories
- Should I reset $wp_query?
- Exclude a Woocommerce product from WP_Query
- WP_QUERY wrong ammount of posts
- How to add sort order to incremented and paginated category loop
- Sorting search results with custom dropdown
- Expecting statement error from php loop using ACF plugin
- How do I sort this custom list of sticky posts
- Query only displays one page_id
- WP_Query will not display draft posts
- Get posts with no tags?
- wp-query, pull children of parent page
- I am officially missing something about transient posts
- How do I get the content of a custom instance of WP_Query?
- How to apply pre_get_posts to a custom query?
- WP_Query, Paginate by Custom Field
- Block internal search queries with pre_get_posts and regex rules
- is_user_logged_in not working from WP-API (wp-json)
- Search Exact on WordPress – Relevannsi Solution Not Working
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Show a message if there are no active posts in category
- How can I re-query post_type and rewrite the url?
- Problem with my loops
- display the children of the post using the current page as the main parent
- Display 3 levels of categories on page
- Paging works correctly on local version, but not live?
- Custom post type loop error: Trying to get property of non-object
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Display three sequential posts on each page load, without repeating previous
- Modify query to exclude certain ids and certain parents and its corresponding children
- How to make a wordpress loop file that displays posts based on certain conditions
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Issue in If else condition [closed]
- Pagination not working with WP_QUERY
- How do I display posts with specific value in a custom field into my loop?
- Order by multiple meta keys on wordpress
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- wp_query pagination links producing 404
- Display First posts without the default featured image
- Custom post types loop on a page template
- Pagination problem with multiple loops on the same page
- Can’t seem to get an else statement correct? [closed]
- Output ACF field dynamicaly within a taxonomy loop [closed]
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise