Support

Account

Home Forums General Issues Problem with searching/filtering text field Reply To: Problem with searching/filtering text field

  • When it comes to WC I generally try to use product attributes instead of ACF fields and then use existing search plugins for searching products.

    There are plugins available that will can be used to include custom fields in the WP keyword search.

    I usually go a different path when it comes to keyword searching and ACF.

    but for creating a search field that specifically searches a single field by keyword, I have not seen anything like this, all I can do is point you in the right direction. Like I said, you need to split the input into words on spaces and punctuation, I would probably try something simple like

    
    $parts = preg_split('/\W/1', $string)
    

    This will split up a string on any non word character. Then you build the query that does a LIKE query on each for each part. It would not be perfect, but it would get the job done.