Your question it make sense to me my friend but the get_categories don’t have the option to order by “meta_value_num” and then order by custom fields.
What you can do is order after you get the array using the usort php function:
$all_subcategories = array('parent' => $categoryID);
$categories = get_categories( $all_subcategories );
function order_categories($a, $b) {
if ($a->term_id == $b->term_id) {
return 0;
}
return ($a->term_id < $b->term_id) ? -1 : 1;
}
usort($categories, "order_categories");
It work fine for me. I used ACF to add the category order field but is fine the way you made it and should work.
Related Posts:
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- get_pages sort alphabetically by meta value
- Assign/update the custom field value for all posts
- Order by custom field date with ASC order
- How to break meta values into different items and avoid duplicates?
- WP_query : meta_key with custom rule for specific value
- Escaping Quotes
- trim custom field text value and show (…)
- Query post order by post and desc not working
- How to wrap meta values seperated by comma in ? [closed]
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- Run a check for multiple meta key values
- Filter by custom field (meta_key) using JSON API
- How to select posts from multiple categories and metavalues?
- Removing link ” from ” on meta_value in custom feilds
- How to get categories with posts by custom field value?
- Sort alphabetically by custom field
- Trying to sort and display categories(not posts) by custom field: ‘order’
- pre_get_posts : only get posts by wp_usermeta value
- Get categories query not working in function.php
- meta_value and meta_key filtering returning no posts [closed]
- IF Custom field value equals ZERO
- List custom field values in alphabetical order without repetition
- How to update a custom field in all posts with the value of another custom field in the same post?
- Update post meta custom field using block editor
- How to add custom filed value after in wp post title
- Sortable Custom Columns not sorting correct
- query_posts with meta_value
- Show array of meta_value in Edit Post Coloum
- Making WP_Query limit results by date before today where date is a meta_query
- User query – getting values for custom meta keys/fields
- get posts based on non-single metadata
- Set class if a meta value is set within post archive
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Create Shortcode shows only posts with custom_field meta
- 4 Unique Random Posts based on Custom Field Values
- Custom Field: Display only if a specific key is selected outside the loop
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Underscores in custom fields
- Add custom field to the archive page?
- Show only posts which can be commented OR have custom meta field
- Need small coding with Custom Fields Search
- How can I remove fields in the attachment editor?
- Edit Custom Database Tables in WordPress
- How to store the value of a custom field dropdown select for post referencing?
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Add description text under input field for new profile fields
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Echo values from custom field outside loop php
- wp_editor removes paragraph from custom meta box
- Any way to include custom fields in WP_Query results?
- Ordering posts by date custom field
- Using a checklist to search against metadata
- Where did the Add New Custom Field go?
- Admin meta Image Path
- Can’t get metabox value (a url) returned using WPAlchemy
- Syntax highligting for custom fields
- Displaying a checkbox array from advanced custom field
- Display custom field values from posts on frontpage
- Getting Custom Fields from WordPress JSON API [closed]
- Shortcode To Display Post Custom Field Value in Post Title, Post Content
- How to make a customized user registration form using the built in wp-register() template tag
- Link FROM attachment to full post and get custom fields values on attachment page?
- Getting the Featured image URL and inserting it as Custom Field on Post update / publish
- How to display a product features dynamically with icons?
- How to copy data from a custom field to the post_content?
- Custom field as featured image caption
- Update custom field values on edit address page woocommerce
- Is there a (sane) way to get all custom fields for a post, which do not have a leading underscore?
- custom filed from post in the side bar
- Rewrite comment form post ID on submit
- Add a custom field to my custom post type and then get posts which are before the given date in the custom field
- Modifying category order
- Custom Fields not working properly
- Custom meta POST request fired twice when updating a post in Gutenberg
- add meta box considers the selected option as post parent
- How do I display a custom field in an existing form on the front end?
- How to save array option as text and not integer?
- Extend WP_User_Query or WP_User to return all custom fields?
- Quicktag button to automatically add a custom field to a post
- Display custom fields only if it has a value
- WordPress taxonomy child image
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- Add nofollow to custom field link and make domain exceptions?
- wordpress simple post multi rating with post_meta and user_meta
- Custom fields are not displaying in page with multiple loops
- Download stuff after filling fields?
- Adding custom field to Lightbox in header only pulls current page data, not Lightbox item data
- Meta boxes not displayed, data isn’t being saved
- Custom registration form and custom field
- How can i put a custom field inside this php
- Multiple permalinks for a single post from custom field
- Search for meta_query does not return any result if combined with title