We’d like to have an exact search on our websites, also over all ACFs. Normally we’re using the WP plugin “SearchEverything”, but we figured out, that there are 2 problems when you’re using SearchEverything and ACF Pro together:
1. ACF Pro does not remove the corresponding database fields, when a post becomes duplicated and its flex or repeater fields will be deleted. So SearchEverything will find content, that’s no longer up-to-date and therefor won’t be displayed in the frontend.
2. If you’re using relation fields (we need them very often), SearchEverything won’t search in the related posts. As result of this, content that’s present in the frontend, won’t be found if someone searches for it.
Please, have you got any idea how to fix these two insufficiencies or what plugin or tool to use, in order to get the right search results from all relevant ACFs?
Thanks and best regards
There are some premium search plugins that will solve the 1st problem. One of them can be found here https://facetwp.com/, there are others. It needs to be a search tool that will work with ACF and there aren’t that many of them.
There is nothing that I am aware of that will search related content. That is search the content of a related post in a relationship field and consider it to be part of the post that’s being shown. If you do find a solution for this that works without needing to manipulate data in some way, please let me know.
What I do for searching related content is that I build filters and actions that add the related content to hidden meta fields in the post. So, basically, all the content from all of the related posts is duplicated in the posts that are searched so that it can all be searched at once. I’ve even created a plugin that will do this integration. The main problem with this is all the extra content and custom fields that are required to make it work. https://github.com/Hube2/custom-field-converter
thank you a lot for your quick and detailed response. To use FacetWP along with some actions/filters that store related content data in custom fields, seems to be a nice way to solve both issues. Of course it’s required to implement additional code, in order to create theses extra custom fields, but how can a plugin know, in which data of a related post to search in? 🙂
I will have a look at your plugin later …
Thanks again, so far
It depends on what type of search you are doing really. If you are doing a keyword search you could probably use something as simple as Search Everything https://wordpress.org/plugins/search-everything/
The thing is that you need to tell it where to search and the content needs to be part of the post you want to return as a result, usually in some hidden post meta field. WP and ACF have some limitations, the best that we can do is work around them.
You must be logged in to reply to this topic.
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!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.