I’d like to modify the query so that it also searches the posts content. How can I go about that?
Is $field the search term entered into the relationship search box I tried
function acf_relationship_content_search( $args, $field, $post ) {
$args['s'] = $field;
return $args;
}
add_filter('acf/fields/relationship/query', 'acf_relationship_content_search', 10, 3);
to include the field in the wider search for post_content but no dice.
Any help anyone can give me would be greatly appreciated.
Thanks,
Hi @smrubenstein
$field
is not the search term, it is the ACF field object (relationship field settings).
The search term is already added to $args['s']
. Please debug the $args array to see what data it contains.
Thanks
E