I just ran into this with WooCommerce. I ended up passing the IDs I needed to a variable for safe keeping, and then hooking a function with extremely low priority. That worked fine. I figure woocommerce or what of my cleint’s 8000000 plugins was overwriting post__in.
add_filter('pre_get_posts', 'assign_ids', 1000);
Related Posts:
- WordPress Number of Posts Not Changing With posts_per_page
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Random sort within an already sorted query
- how to get a different html for odd/even posts?
- How to exclude latest x posts from a paginated query?
- How to know if get_posts() failed?
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- I have over 4000 posts, will querying some of them cause performance issues?
- Duplicate posts
- Looping through posts per category gives same posts for each category
- How to add posts to wp_query result?
- Trying to put an array into ‘post__in’ => array() query not working
- Order post by year DESC and month ASC
- How can I display a specific user’s first published post?
- Replace Main Query With Custom Query
- Query All users that has post
- Custom Order in WP Query
- Search query – exact post title match
- Sorting posts alphabetical that have single digits
- Check if post exists
- Display page content AFTER a loop of posts
- Get posts by multiple ID’s (query)
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Query how many items to show in shortcode
- how to get posts ids inside pre_get_posts filter?
- Get posts by name and taxonomy term
- Get Posts that are in the current month or later
- Sticky post appears twice
- How Can I Query a Specific Page From a MultiPage paginated Post
- Get Meta Key Value While Saving Post
- How to exclude latest x posts from a paginated query?
- Posts will not display on page-mypage.php
- filter RSS feed in URL
- WordPress custom Query for Posts in Category display posts multiple times
- Exclude the first ‘n’ number of posts of a tag from home page?
- How to setup a query to output posts by groups of five?
- How to get posts and comments amount per hour, per year and per month?
- First x post with another template then the others
- Delete all drafts?
- Wrap every month posts in div
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Counter is skipping post when I still want it visible [closed]
- Can’t get full post title if there a spaces in title
- How to get all post_parents of a post?
- Why posts array is empty?
- Run query_posts if SESSION is empty?
- Exclude some posts from displaying in wp_query based on some condition
- Related Posts function not working
- Custom Post Limit for homepage only without plugin?
- How to convert query sql to shortcode in wordpress?
- WordPress loop not working on static front page
- Adjust the order for returned posts
- Export all posts to import as product items
- get last post’s link with SQL query
- Trim posts from WP-Query?
- Custom Select Query – Selecting the Year?
- Get current taxonomy and display query accordingly
- Prevent duplicate pages from being added
- Show 10 latest posts only from users with contributors role
- WordPress, custom post type and posts query help!
- How Can I Always Display A Particular Post First Using WP_Query?
- Return records between two meta datetimes saved as strings
- How do I display main query posts in random order using add_filter
- WordPress Query – Display 5 posts (same post type), each from a given tag
- how to add tags to post in the Loop?
- Merge get_comments & get_posts into a single query
- Check if almost 10 year old – working code is up to date
- Query custom post type custom meta key
- Ignore posts content in the posts queries for internal linking
- Bulk Post update_post_meta
- Count posts for pagination
- AJAX load more posts not using correct category and repeating the same few posts
- Sort Events by Venue Title – Sort Post set by related post ids
- Query post for today, if no post get the previous one
- Display the latest post from some selected authors
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Removing a post from the results of a WP Query
- Query posts from a specific category and selected tag
- Displaying Results From Custom Taxonomy Query
- Sort post by category using HTML Select tag
- WP_Query retrieve custom posts but not the post showing
- Special Query: Title, Terms, Content – %LIKE%
- Creating pages and getting their values from the database table
- Make division in post_query?
- Display one post randomly from category on home page
- WP_query sort by custom meta_key “price”
- How to set value in Query Loop?
- Wp_query WooCommerce products
- The page that displays Posts on homepage
- query_post or single-[cpt].php?
- How to var dump urls for all posts
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Batch Scanning and Deleting Empty WordPress Posts