For searching among your posts through Advanced custom fields, use fallowing query:
$args = [
'post_type' => 'post',
'meta_query' => [
'relation' => 'OR',
[
'key' => 'NAME_OF_ACF_FIELD',
'compare' => 'like',
'value' => '%'.$search_value.'',
]
]
];
$items = new WP_Query($args);
while($items->have_posts()) {
$items->the_post();
the_title();
}
This will output the titles that matches our search query.
even you can add more items to meta_query
array to search for example 3 field together.
Also, you can use WordPress filter hook to modify query before execution
This is an example of modifying where statement on query
add_filter( 'posts_where', 'my_posts_where', 10, 2 );
function my_posts_where( $where, &$wp_query )
{
global $wpdb;
if ( $search_title= $wp_query->get( 'search_title' ) ) {
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( $wpdb->esc_like( $search_title) ) . '%\'';
}
return $where;
}