Home › Forums › General Issues › Adding custom fields search to WordPress search › Reply To: Adding custom fields search to WordPress search
I recommend Relevanssi for this. The advantage of using Relevanssi is that it pre-indexes your custom fields (and thus keeps your public searches up to speed).
Use your imagination expanding the following code sample:
function relevanssi_add_custom_fields( $fields )
{
$fields = array(); // I like to start fresh
$fields[] = 'text_field';
$fields[] = 'people_0_firstname'; // meta key for 'firstname' field inside 'people' repeater.
$fields = implode( ',', $fields );
return $fields;
}
add_filter( 'option_relevanssi_index_fields', 'relevanssi_add_custom_fields' );
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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.