I have a file named search.php, where all the search results are added.
The search form is located on the homepage. The problem is, I have no special page for the search results, but I want to add ACF fields to this page. I have searched in the dropdown menu ‘location’ in the ACF plugin, but I can’t find the search.php file to add groups to. I am sorry if my explaination is a bit vague, but I don’t know how to explain this exactly.
Summary, I want to add ACF fields to my search.php search results page.
Terminology: ACF stand for the Advanced Custom Fields plugin in WordPress.
You can also do it using plugin but use below code to avoide plugin.
You need to add this code in you function.php file
for reference – https://gist.github.com/charleslouis/5924863
Try This solution if first is not working.
https://support.advancedcustomfields.com/forums/topic/making-customfields-searchable/
it works for me