Thank you for all the comments! With your help I managed to rule out a standard WordPress issue. I couldn’t find the culprit (As @DaveRomsey suggested, it could be one of the get_terms or get_terms_orderby hooks altering results). In any case, I solved it by sorting the array:
$searchedterms = get_terms( 'category', array(
'name__like' => $s,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true
) );
function cmp($a, $b){
return strcmp($a->name, $b->name);
}
usort($searchedterms, "cmp");
Related Posts:
- Sort categories by custom field in WordPress admin
- get_terms vs. get_categories: does it matter?
- Woocommerce get category image full size
- Order get_terms() By Custom Field
- Fixing category count
- How can I get category ID by category name?
- get_terms name__like list categories according to letter
- Elegant way to add parent categories?
- How can I select a primary category?
- Sort posts by tags in category pages
- How to search for categories and/or tags?
- Sticky posts on home page, search, tag and archives without plugin
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Excluding posts from a category but only if they’re not in multiple categories
- How to create a category and sub-category sorted blogroll with all posts?
- Sort category page with custom field
- Update term count using a callback function
- Custom Query to search through categories
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- How to show empty category in admin menus search
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Getting the sub category
- How to select product category while adding new product in woocommerce? [closed]
- Use get_term_children to get the sub category of a parent category for the current post
- How do I get the total number of categories in a list of search results?
- Update wordpress post terms programatically
- Get a list of Terms for a specific category
- Filtering search results
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- How do I get a list of all categories that a given user has written blog posts for?
- Multiple Category Search
- get_the_category and echo out link to child-most/deepest category
- Set post categories to include parents when setting child category
- I need to create a search form that will display search results from specific category
- Limit number of terms that a custom taxonomy can save per custom post type
- Inserting Category programmatically
- How to query post like normal search would do. within search.php page
- How can i insert term in a specific language of Polylang?
- WordPress search only showing a few posts
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Select posts by name and category per REST API
- How do I toggle pagination on/off in search results and category listings via a link?
- Is There a Difference Between Taxonomies and Categories?
- Custom taxonomy/category order
- wp e-commerce group product by category [closed]
- Get posts from specific taxonomy term
- Get posts under a category with SQL
- How to let users choose posts order in categories?
- Display custom taxonomy attached to the post on post single page
- Count the posts number for every category
- wp_dropdown_categories not showing option as selected
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- Display sibling categories on category page
- Count tags for a specific category
- Group search results by category
- set terms to category and subcategory
- Woocommerce search form with category select
- Using if statement in index.php instead of creating separate template files
- More efficient way to list posts by category [duplicate]
- Exclude categories by ID
- Using in ‘category_name’ in ‘$query->set();’?
- How to store category and tags separatly on wordpress?
- Add multiple orderby with pre get posts
- Post to inherit custom category background image from parent
- wp_delete_term or wp_delete_category?
- Update custom category fields front-end
- Combining these queries? (Same taxonomy term + same category as post)
- WP-CLI Add category as menu item main-menu
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- get_object_term_cache duplicate terms after update to wordpress 6
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- Return all Tags and Categories in Separate List
- Ordering terms whilst in loop
- Replace deprecated get_category_children code with get_terms
- Can’t display posts by filtering categories using isotope.js
- How to remove parent category from child category url using wordpress rewrite rule?
- Get WooCommerce product category list in functions.php
- Restrict retrieved terms by category?
- List non-empty categories from a custom post type
- How to modify custom category field from front end?
- Woocommerce Category Sort Dropdown
- outputting taxonomy hierarchy
- Search Replace Database ONLY for posts of certain category?
- Bulk Change WordPress category Slug
- Search by tag, category and author without plugin
- show only terms from parent category
- Issue with WordPress category search
- Getting a sub category based on a category name
- 404 error when i try to search by category or by tag
- A search box for all sites – Multisite
- List Terms by category
- get_adjacent_post_link excluded_terms ignored
- exclude parents from the_terms
- Search functionality with multiple categories
- Display category tree of a post in search results
- get_category_children/ the new get_term_children not work
- Taxonomy term RestApi data 10 rows limitions
- hide_empty property not working when using get_terms
- Display different sidebar based on search results from one category
- Using same term for slug and category