Support

Account

Home Forums General Issues Taxonomy Matching Starting with first letter typed (not third) Reply To: Taxonomy Matching Starting with first letter typed (not third)

  • ACF populates the "search" argument for get_terms() https://developer.wordpress.org/reference/functions/get_terms/ with the entered value. also see https://developer.wordpress.org/reference/classes/wp_term_query/__construct/

    WP automatically changes this to "%{$search}%"

    In order to change it to `”{$search}%”, which is what you’d need to do to only get results that start with what’s entered, you’d need to alter the SQL query. I’m sure this is possible using some filter in WP, but I don’t know what that filter is or how you’d use it.

    Doing a quick look this would probably be done using this hook https://developer.wordpress.org/reference/hooks/terms_clauses/, but there isn’t much in the way of documentation that I found. This seems to be headed in the direction you want https://wordpress.stackexchange.com/questions/123298/term-begins-with-a-letter