advanced custom fields - Use 'LIKE %word%' for ACF Query Wordpress -


i use acf plugin on wordpress site , want code custom research. have many products , want display products contain searched word.

i query :

$args = array(             'post_type' => 'product',             'meta_key'      => 'brand',             'meta_value'        => $word,             'compare'   => 'like');    $the_query = new wp_query($args); 

but display products brand matches $word. exemple if search "yan" want display products brand "yanmar", "polyan", "tryanpo", etc.

how please ?

thank , have day !

try below code.

$args = array(     'post_type' => 'product',     'post_status' => 'publish',     'posts_per_page' => -1,     'meta_query' => array(       array(         'key' => 'brand',         'value' => $word,         'compare' => 'like'       )     ) ); $the_query = new wp_query($args); 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -