orderby
should be e.g. meta_value
or meta_value_num
– various specific meta_type
‘s are available – to order by meta data. Additionally a meta_key
has to be set and present in the query. To be exact and to avoid misunderstandings, meta_key
has to be the keyname
of the field you’re sorting by. Take a closer look at the Order & Orderby Parameters and Custum Fields Parameters section of the WP_Query
documentation for more information.
Related Posts:
- Advanced search by two criteria – sort by location and date (ascending or descending)
- How to populate custom field dropdown box based on prior selection?
- Custom search SQL Query to add custom field in result
- How to exclude custom fields from search queries?
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Compare ACF date field (if exists) and post date and order DESC
- Search & column order by meta value in admin
- searching by keywords in post’s metas or pagination links problem
- Create custom query for search?
- How to display search query as formatted text?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Validating Custom Meta Box Values & Required Fields
- Add a Jquery Datepicker to custom field in post edit
- Add custom fields to search
- How to rename a custom field?
- How can I make wp-pagenavi work on a custom query built upon a form submission? [closed]
- Meta Query with AND & OR?
- Custom search: by post data and post metadata?
- Need small coding with Custom Fields Search
- Auto sort the wp-admin post list by a meta key
- Arrange custom fields with drag and drop?
- Search ONLY by meta key / meta values
- get_pages sort alphabetically by meta value
- Add custom field (value) to search result (without plugin)
- WordPress Search Custom Meta Field Only
- Exclude custom post type from search by custom field value?
- ajax jquery update custom field meta value front end
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Plugin similar to Taxonomy Drill-Down for custom fields?
- Sorting posts by multiple values, combined
- Extend ‘The Events Calendar’ search to include custom fields [closed]
- Include woocommerce custom field value in front-end search result
- Count how many posts have a custom field set
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Using a checklist to search against metadata
- Custom Fields Not in Search Results
- Sorting posts ordered by custom field value
- Sorting WordPress Posts via Custom Field Values?
- Custom Field Create Bulk via SQL Query
- Create Pop-Up Box with Custom Field Content Inside the Loop
- query usermeta from custom field
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- Order RSS content by an advanced custom field value
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- jQuery – Automatic event trigger does not **really** check my form
- Merge Multiple Custom Fields into one New Custom Field for Searching
- Alter main archive, to show posts with meta as last
- Sort custom post type by multiple custom fields
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Trying to reorder posts by custom field
- Limits, not all post are showen when querying for posts by view count
- filter custom field values $min $max
- Restrict WordPress Search to Custom Field
- Show user info in a hovercard [closed]
- Sort WP_Query with numeric custom field
- Get post ids sorted by meta_key
- pre_get_posts : only get posts by wp_usermeta value
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- Select custom posts by meta_value and sort by a different meta value
- How to use media upload on metabox post page without breaking TinyMCE?
- List custom queried terms in the edit-tags.php?taxonomy page
- change order of images attached to post
- Sort posts by clicks on download button
- Modify date query by URL parameter using pre_get_posts and $_GET
- Loop through incrementing custom fields
- How to manage a particular “order by” for get_search_query()?
- The best way to collision check in WP
- Listing the most popular 8 city (custom fields) as used in posts
- WP_Query () using taxonomy, custom post types
- How to sort by custom field value?
- How to query for posts with either one or another custom field
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Get array of posts based on custom field values
- How to query posts by month based on date custom field?
- Filter or order based on custom field
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Type character in name and make it invisble
- Problem with revisions only returning four results
- search based on custom field
- How to save multiple custom user profile fields using repeater JQuery
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- select user with all meta field and field value. I am use Below Query for this ,So any of know another way to fast query instead of below query?
- Sort posts by custom fields with empty values
- Admin – Search Events by a custom field
- Search one custom field?
- Query Custom Fields in Searchform
- Get custom fields when hover link of post
- CSS conditional on custom field value
- query specific posts according their custom fields, using sql SELECT
- Meta_query not filtering posts
- Get multiple posts with some custom fields efficient
- How to add a prefix to existing custom fields over MYSQL query?
- Complex WP_Query Using Post Date And Post Meta
- Custom search with meta fields
- list pages by custom_field?
- How to check if custom field exists in this widget query
- Only show content slideshow if “slideshow” custom field exists
- Sort posts after filtering them through multiple taxonomies
- Can’t sort custom column on user.php by number / meta_value_num?
- Search for meta_query does not return any result if combined with title