Unnecessary queries when using post__in
-
I’m working with a custom search template where I create a WP_Query and pass it to relevanssi_do_query(). One of the query args is ‘post__in’ where I pass it an array of posts that I want to restrict the search to. While the results are indeed limited to the posts listed in ‘post__in’, according to the plugin Query Monitor, a large number of queries are generated for all posts matching the search term and not just those defined in ‘post__in’. In particular, the callers with the most queries are update_meta_cache() and WP_Post:get_instance().
Why is Relevanssi making queries against posts not listed in the ‘post__in’ arg? Is there a way to reduce the number of queries?
I observe similar behavior when filtering using the ‘post_type’ arg.
- The topic ‘Unnecessary queries when using post__in’ is closed to new replies.