You can use usort to sort the object $children
.
The function to sort after you got the $children
object can be like this:
usort( $children, function($a, $b) {
$ai = filter_var($a->name, FILTER_SANITIZE_NUMBER_INT);
$bi = filter_var($b->name, FILTER_SANITIZE_NUMBER_INT);
if ($ai == $bi) {
return 0;
}
return ($ai < $bi) ? -1 : 1;
});
Related Posts:
- Show all terms of a custom taxonomy?
- Get used terms by an author as array of strings
- How to get the term before the last from a custom taxonomy?
- WP_Query use for a filter with multiple Taxonomies and Terms
- get_the_terms – only top level
- Query all posts of a custom taxonomy term
- get_term_link() returns incorrect url
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to get original custom taxonomy slug after the slug has been rewritten?
- How to get post’s current parent term ID?
- Copy taxonomy terms from one post to another programmatically
- How to filter custom taxonomy term name, slug, and description?
- Hierarchical taxonomy list with modificated term links
- Exclude product attributes from taxonomy terms loop
- Create a a form for custom taxonomy terms
- WordPress custom taxonomy
- How to break up php code to avoid echo
- PHP displaying wrong custom taxonomy images
- How to retrieve taxonomy Metabox fields in frontend
- how to display child terms with parent terms in custom taxonomy?
- Pass custom value to custom taxonomy
- WordPress different custom tag being displayed in on tag list
- PHP Warning: Attempt to read property “term_id” on bool
- Grab posts by multiple categories
- Remove the first 5 characters of the_title and orderby that
- how to fix error “called incorrectly, should not be accessed directly”?
- Displaying custom taxonomy on WooCommerce product page
- Sort order by slug for looped child terms of custom taxonomy
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Set Order Status to Complete After Payment – from another site
- Get term siblings of current child taxonomy
- comments sorting incorrectly across multiple pages
- Insert term and child term from frontend
- multiple taxonomy select display only one in front end
- Display parent and child taxonomies in separate drop down select fields
- How to show only subcategories in parent category not parent category?
- need help with existing code showing subpages
- Custom field values to taxonomy terms
- Pull Tags But Not as Links
- List taxonomy term slugs within shortcode (do_shortcode)
- Include Parent Term in wp_list_categories
- How can I access string value in an array?
- get_total () returns 0 – woocommerce [closed]
- Limit Taxonomy Output in Conditional Statement
- Weekdays as terms – How to order taxonomy terms by ID in admin panel?
- Get all categories post is not in
- How can I display a div ONLY if it is not a certain term page
- Display all pages – in order
- Getting taxonomy images to display on single-post with their terms
- Hide image if taxonomy term is empty
- Isotope Drop Down Categories Filter Function
- working with term_relationships table
- Ajax filter button display all posts
- Use get() method to grab all categories and output inside another method
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- Show the section only if custom taxonomy was chosen
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- Listing titles and custom fields of entries within subcategories
- fetch woocommerce product with custom taxonomy
- Storing content into a custom taxonomy
- Commas not displaying in implode
- Creating a Category Taxonomy
- Check in which custom taxonomy belongs and change the style
- How to add a date creation field when a custom taxonomy relationship is created?
- making php value numeric
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- Order taxonomy terms wordpress
- Taxonomy term description with style, only if the description exists?
- Trying to display terms from custom taxonomy within function
- WordPress: Displaying all the post tags from within a specific taxonomy’s term
- how to insert content into my taxonomy
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Hi need update in my terms for other taxonomy
- How to WP_Query posts order by parent title?
- How to change the author box selection on a post to a custom taxonomy
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- WP_Query – How to query all of post types categories
- Show related products by attribute based and certain conditions
- Display acf taxonomy attachment
- How to hide a child category and show his parent category
- How do I edit the terms output args or array data?
- Get taxonomy terms that share a common object property
- update_term_meta() only updating once on certain meta keys
- How to update posts’ custom taxonomy selection?
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- ACF Taxonomy field values not select in backend
- How to add Text before my Custom Term and hide it when empty
- Ordering terms whilst in loop
- How can I change the background color of divs dynamically (depending on an order-status in woocommerce)?
- How to order taxonomy terms by most recent post?
- Categories does not show Block editor WordPress
- ACF – Can’t get custom post type by taxonomy
- Create category after theme setup and modify the default one
- custom taxonomies not working
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
- WordPress search query, how to modify the sql