Home › Forums › ACF PRO › add post type to search results and filter by meta value › Reply To: add post type to search results and filter by meta value
Sorry for the late reply, yes, too many nested queries can cause the query to time out.
You have a complex search. I have done similar things.
You could simplify the search by doing some more work. You want to exclude some fields from search.
I would set up a standard WP meta field “exclude_from_search”
When one of your custom post types is updated add an acf/save_post filter. In this filter determine by your custom fields if the post should be excluded and update post meta “excluded_from_search” to 0 or 1 (false or true).
The you can simplify the query to look for this field not existing or set to 0 rather that have multiple meta values that need to be looked at.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.