Try
'post__in' => array(0)
Simple and to the point.
Update:
'post__in' => empty( $include ) ? [ 0 ] : $include,
Related Posts:
- Refine search results using WP_Query
- Custom Search Not Consistent with Results
- How to make search for posts using get method?
- How do I get my custom query to work with search results after the first page?
- Search.php – return number of results but cannot loop through
- Custom search (wp query by custom fields)
- Help with showing text when something is entered in my search bar
- Some doubts about how the main query and the custom query works in this custom theme?
- Loop within a loop?
- Show posts without term
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Search custom taxonomy term by name
- get_template_part in for loop
- Display posts the match taxonomy term linked from wp_list_categoies?
- “pre_get_posts” firing on every query
- Show two random posts from custom post type
- Add the “active” class only to the first loop item in a WordPress query [closed]
- How to search by title or tags exclusively?
- Loop inside the loop
- WordPress search exact match
- How do I search WordPress by different fields without a plugin?
- WordPress custom search form with pre_get_posts not work
- cloning a WP_Query
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Add custom search results to main WP search [duplicate]
- How is WP_Query connected to WP_Post in The Loop?
- 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
- How to retrieve current page WP_Query arguments?
- Get posts for last working week in WP_Query
- How to limit WP_Query to one result on the loop?
- query user display_name failed in a custom mysql query foreach
- Query posts by specific word on title
- Multiple taxonomy And acf filter group by
- How to use offset in WP_Query
- Reset postdata to custom query in nested queries
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- How to Filter Posts by Custom Fields?
- Multiple loops without repeating content
- Multiple Search Terms WP_Query
- Filtering posts from different categories into different section by doing WP_Query only once
- Loop Split two Columns
- Search by post id in a specific page then auto-redirect to searched post
- How to list posts with disabled/closed comments, with pagination?
- How to make a second query offset -2 from current post
- Add filter post_where and passing post_type argument
- using pre_get_posts for search results not found
- Transient api Caches confused
- Best choice for multiple loop in page?
- WP Query – order posts by meta field first and then order the rest
- Wp_query with 2 meta keys and array of meta values
- Wildcard search in WP Query
- Search Page Returns Nothing
- How to create custom query by keyword in post title?
- Create a loop on my pages with new “WP_Query”
- Redirect Search to Form When No Product Results Are Found
- WP ForLoop to compare meta information of posts to determine what post to display
- How to filter query loop block with a search string from the query parameters
- change posts_orderby of the callback wp_query?
- Different Loop for tag pages?
- Pagination for custom loop on custom page template is not displaying anything
- 2 queries with counters
- Writing less unnecessary code with WordPress
- Creating ‘posts page’ loop based on the page itself
- How to sort by most watched in X days/months
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- $wp_query->found_posts not returning correct value
- How can I use arrays and a foreach to generate many lists with WP_Query?
- How to use custom page for all posts with custom url, call another directory?
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- display ACF repater field in archive page
- Duplice post with standard WP loop – fixed by using query_posts() instead
- Pagination repeating posts on search results
- WP_Query breaking the loop in a nested loop
- Check the stored / cached WP_Query with transients on post change
- New template file does not load category-specific post
- Filter admin ajax data by url query
- Get categories within specific term
- Custom query for custom post type not getting correct post ID
- Query post with content only
- Search with WP_Query, but ignore href URLs in anchor tags?
- Why is my query not giving results?
- why default wordpress loop not working outside index.php
- Continue loop after $queryObject
- custom query – offset to pagination
- How to make the default WordPress search return borader results
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- List ALL posts within last week from current category on category page
- Manipulating a query
- loop through custom post types with meta data
- Using Query In Post Type Archives
- Query posts by custom fields
- Multiple loops on index page with sticky post and pagination
- Searching in specific custom post type
- Search (Custom Form, Custom Search Result)
- tax_query not working properly with get_posts
- the_excerpt() not working in custom archive
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- Search results stuck on page 1
- Pagination only showed when no category is set in wp_query