Wordpress meta_query / Sort array in php for autocomplete -
i have autocomplete plugin in wordpress website. results shown in alphabetical order (limit 10) query : 'foo' shows me :
a...foo.. a.. foo... a..... foo a. foo.... a.. foo... a.... foo. b.... foo. b. foo.... b.... foo. b. foo.... b.... foo.
this php array
$suggestions[] = apply_filters( 'yith_wcas_suggestion', array( 'id' => $product->id, 'value' => strip_tags($product->get_title()), 'url' => $product->get_permalink() ), $product );
i want have in suggestion array similar string "foo product"(which 43st in php array) , not other product contain word "foo".
how can sort $suggestions show closest value 'foo' in first result ?
thank much.
Comments
Post a Comment