Support

Account

Home Forums General Issues Adding custom fields search to WordPress search Reply To: Adding custom fields search to WordPress search

  • As this is article comes up a lot in search results, I wanted to add my experiences.

    I prefer coding to plugins whenever it makes sense. Without a plugin, I was not able to search both the post title and the ACF fields for a custom post type. Making changes to functions.php and/or creating a custom WP_Query, I just couldn’t get there.

    Using ACF: Better Search, I found it includes ACF fields on the search result page (search.php) but doesn’t work for custom post types (archive-my_post_type.php) or custom WP_Query.

    I installed Relevanssi and it offers a simple way to include post types and custom fields. I ran the index and it works perfectly for me.