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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.