You probably can find some way to make MySQL do the sort for you, but an alternative approach is to make it into an ASC/DESC order by adding additional meta in which you put a numeric sort order value based on whether it is apple, bag, etc and update it when the post is saved. Than all you need to do is to sort by the “sort” meta field.
Related Posts:
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- WP_Query orderby date not working
- Order by optional meta key?
- Sorting: custom query with orderby meta_value_num THEN by title
- Order by DESC, ASC in custom WP_Query
- WP_Query order by multiple meta keys & fields
- Secondary Sort (fallback) for WP_Query
- Query Posts in a Predefined Order
- How to get order of posts?
- Order posts by ID in the given order
- Sorting posts by custom date fields (non standard date format)
- How do I order pages and categories by ID or name in the same query?
- WP_Query sort by comment meta data
- Order posts by tags count?
- Merge 2 args in one WP_Query and order it by date
- Orderby = none not working [duplicate]
- WP_query ‘orderby=none’ Problem
- Revolution Slider Orderby Two Custom Fields
- Order posts ascending with number in title
- List taxonomy terms plus their latest post ordered by post date
- How to use order RAND() on WordPress?
- Ordering by meta_value AND date NOT WORKING with wp_query
- WP_Query orderby breaks when using AJAX?
- Custom Post order for homepage
- Change default ordering of taxonomy terms – pre_get_terms
- WordPress WP_Query orderby being overwritten
- WP_Query Order by Specific Post ID First
- Order Posts by meta value AND published date
- Sorting posts DESC based on the number of comments using WP_Query
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- pre_get_posts order by not working
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Orderby ASC changes to DESC in WP_Query
- How to set multiple `orderby` in query argument?
- WP_Query order result by date AND meta_value
- Order by title without taking into account ‘the’
- WP_Query orderby author__in
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Weird orderby => post__in issue
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Order by empty custom field
- How to order posts by title after they have already been sorted by category
- Advanced ordering of query_posts
- Help ordering Post loop by two meta values
- meta_value_num not ordering all items
- WP Query – order posts by meta field first and then order the rest
- Ordering posts by an array
- How to Create a Random List of Child Pages
- Specify strict ‘order by’ in WordPress query
- Order is breaking wp_query
- How order posts from category by date and comment count?
- Child pages not affected by orderby
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- Orderby two meta fields not working
- Sorting posts by Multiple custom fields in defined order
- WP_Query orderby random do not repeat infinite scroll – one loop
- Sort posts using multiple custom fields and menu_order in single query?
- WP_Query order by multiple meta keys & fields
- How can I order a post query’s results based on the number of matching taxonomy terms?
- How to sort wordpress posts already selected by WP_QUERY
- Custom WP Query order function possible?
- Custom order of posts in wp_query and different taxonomies
- WordPress Query custom ordering by temporary variable
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- Meta query orderby meta_value_num sorting by role first
- WP_User_Query Orderby Not Working
- Order by value of Custom Field using url string
- Order posts by tags count?
- WP Query with meta queries
- Order Element By Custom Field in WordPress
- Query Order By Number Variable From API
- Order 2 meta_queries differently in WP_Query?
- Sorting with meta_query and multiple, optional meta keys
- Best way to query posts and order by relevancy to query
- Order & Orderby clause not working with custom query
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Order posts by more than one variable (meta_key and publish date AND time)
- Create custom order sortby based on array of id
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Sort by meta key within same day
- Query All Attachments and Order by Parent Publish Date
- Using orderby with 2 meta keys
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Show sticky post before other WP_Query
- Custom query to order by multiple taxonomies
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Get post closest to today
- orderby in WP_query doesn’t works
- Posts2Posts, wp_query and orderby issue
- Order by meta values
- Change posts archive ordering
- orderby and order filter in get_posts or WP_query function in wordpress not working
- Why does wp_query only display the most recent post when using order ASC?
- new WP_Query with order args – no more distinction between categories