In need of some help. I have my search results showing the custom post type with all the ACF fields inside. What I want is the search result to show the ACF singularly with a field name of file_name that is a text field and file field file_pdf. together they would be one result from any given amount of posts from the user. I can't seem to understand the way to code this. I'm currently using relevanssi plugin. I'm struggling with the idea of filtering just those two fields to show in the results.
function wpb_search_filter($query)
{
global $current_user;
if ($query->is_search && !is_admin())
$query->set('author', $current_user->ID);
// $query->set( 'post_type', array( 'pricing', 'attachment' ) );
$query->set('meta_query', array(
'key' => 'file_pdf',
'value' => $query->query['s']
));
return $query;
}
add_filter('pre_get_posts', 'wpb_search_filter');