You will need to filter the query, which you can do with the terms_clauses
hook. This is very similar to G-M’s solution but does not require a prefix on your search string.
function old_style_name_like_wpse_123298($clauses) {
remove_filter('term_clauses','old_style_name_like_wpse_123298');
$pattern = '|(name LIKE )\'%(.+%)\'|';
$clauses['where'] = preg_replace($pattern,'$1 \'$2\'',$clauses['where']);
return $clauses;
}
add_filter('terms_clauses','old_style_name_like_wpse_123298');
// $letter="str"; // test
$terms = get_terms( "ingredient", array( 'name__like' => $letter ) )
Related Posts:
- Why does WordPress combine a term with the same name in the wp_terms table?
- Correct use of get_the_terms()
- wp_list_categories: order by term order?
- I have a term_taxonomy_id — is there an API call to get the taxonomy?
- Exclude Child Terms From Parent Posts
- same taxonomy for several post types: how to hide empty in a specific post type?
- How to sort terms with diacritical signs?
- get_terms(); show private posts when logged in
- Get category ID after wp_insert_term
- How to order get_term_children output by alphabetic order
- How to update incorrect post count in taxonomy?
- wp_update_term not creating new unique slug
- How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero
- Get post terms for multiple posts at once?
- wp_update_term: How could i update the “name”?
- Check if an array of posts has posts from a specific category
- Get only one product category woocommerce
- Get those terms with a specific meta key value
- get_terms() order by term_meta
- What is the term shortlink structure?
- get_term_by “name” not working with & in name
- Invalid argument supplied for foreach() in search.php
- How do I determine if a certain term is in an array?
- Modify automatically generation of slug when term is created
- get_terms ‘number’ parameter does not appear to work
- Does get_terms() use any sort of caching on its query?
- Question with get_the_term_list
- 404 on term taxonomy archive pagination only with some terms
- Clone Terms of one taxonomy to another
- Custom Template for one Taxonomy Term
- Create / Close Div in Array [closed]
- Categories order with get_terms_args not working in 4.7
- Getting all categories even with no products under it?
- import_id parameter for wp_insert_term to create custom ID for category
- get_terms – name__like a number
- Why does wp_get_object_terms add a period after terms are output?
- How to apply comma separation,strip_tags and orderby to wp_get_object_terms
- How to get a post’s associated taxonomies and terms in wp api v2
- wp_set_object_terms not working inside loop
- Leveled – Terms foreach
- Add Taxonomy Description with wp_set_post_terms
- get_the_terms() not returning expected result
- wp_insert_post() does not support variable
- Missing term_id value
- Get the ID of category page with or without any posts
- single_term_title() running before get_the_title() [closed]
- WordPress Term for Custom List
- Get current term in single.php
- How do I print a term list but alter the link text?
- How to get the $meta_type given the $object_id
- Polylang : Display term archive even if no posts
- $args for get_terms() to return ORDER BY FIELDS
- How to create a array that contains all of the children slugs of a specific parent category
- Temporarily un-associate term for an amount of time
- How to extract one field from wp_get_post_terms objects?
- CTP – check for value inside objects
- If product is in sub-category show code
- Get Custom Post Child Term
- Get fuzzy matches from get_term_by
- Problem retriving the post type category
- Taxonomy Drop Down with hierarchical view using $terms
- How to check if a term is parent to another?
- get_terms_args ordering by meta key not working
- Cannot retrieve categories for post in The Loop
- How to show posts from category A on category B page?
- How to use category slug to echo a page’s content with the same slug
- Can we apply hide empty to get_the_terms?
- PHP Warning: Attempt to read property “slug” on bool in tax query
- wp_set_object_terms doesn’t work
- Why does term get inserted twice when using dynamic slug?
- How to use get_terms() returning only the terms that have posts with a certain custom field value
- I can get posts in all categories. But I want to get the custom post type I created
- how to show all categories by get_terms
- How to display taxonomy order child, parent
- Update term_id to new value wherever it exists, to combine the two.
- wp_get_post_terms – Do Not list Duplicates
- Flush rewrite rules after a term is edited
- How to show term child only if has a post
- wp_set_post_terms struggle :(
- How to show only tagged CPT categories / taxonomies for a custom post type?
- Is there any WordPress way to get all categories for some selected posts?
- Order terms by creation date
- Unable to retrieve any child terms using get_terms
- Wrap custom terms loop
- Get terms parent ID for conditional IF statement
- Get count for all terms inside a parent term
- get_terms not working when child_of is used
- add links to list of post terms
- modify strip_tags function to use term slug instead of term name
- When I Use function wp_insert_term() function it gives me Invalid taxonomy object
- get_terms Parent Tags
- Get term_taxonomy_id from return of wp_insert_post
- Get object terms with no children?
- How do I assign a custom post to all terms in a custom taxonomy?
- Attempting to filter posts using get_terms
- is action hook not working on quick edit?
- WordPress emails error regarding the argument type even if the type is correct
- How to solve/debug get_terms suddenly showing no results?
- How to display First level child terms of current term’s parent taxonomy?
- How can I replace the values in WP_Term?