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?
- Using meta query (‘meta_query’) with a search query (‘s’)
- 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
- Orderby meta_value only returns posts that have existing meta_key
- ORDER BY custom field value
- Add a Jquery Datepicker to custom field in post edit
- Including custom fields in search?
- 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
- Convert jQuery Datepicker Format to SQL Date Format
- Filter results with custom field values and dropdown
- get_pages sort alphabetically by meta value
- Add custom field (value) to search result (without plugin)
- Archive sorting functions by custom fields (front-end)
- Is there a way to do multiple ordering on a multiple meta_query?
- Fulltext search in posts sorted by relevancy
- searching in custom meta field
- Order by custom field date?
- 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)
- Is it possible to order posts by two meta values?
- Plugin similar to Taxonomy Drill-Down for custom fields?
- Sorting posts by multiple values, combined
- Sort by posts that have a featured image?
- Extend ‘The Events Calendar’ search to include custom fields [closed]
- Include woocommerce custom field value in front-end search result
- How do I query for a post by custom field?
- Including Database Generated Pages in Site Search [closed]
- Count how many posts have a custom field set
- Adding Custom Fields to Search
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Using a checklist to search against metadata
- How can I sort homepage by a meta value?
- Loop to display random posts only if a custom field matches category
- How do I use wp_query for WordPress search?
- Custom Fields Not in Search Results
- Conditional custom field query
- Sorting posts ordered by custom field value
- Sorting WordPress Posts via Custom Field Values?
- Display only past events on that page using Visual Composer Grid Bulider
- Custom Field Create Bulk via SQL Query
- Create Pop-Up Box with Custom Field Content Inside the Loop
- How make a custom search on backend in WordPress without plugin?
- filtering custom post types via meta data drop down
- 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)?
- Advanced search for meta fields
- jQuery – Automatic event trigger does not **really** check my form
- Merge Multiple Custom Fields into one New Custom Field for Searching
- Change the sort order for posts to include custom field
- Alter main archive, to show posts with meta as last
- Adding auto-complete to custom gravity field not working
- Sort custom post type by multiple custom fields
- Sort alphabetically by custom field
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Search in Archive Pages by subcategory, tag, custom field and year
- Custom WP_Query for WordPress Search Results with meta_query
- Trying to reorder posts by custom field
- Uploading PDF using Media Uploader
- Limits, not all post are showen when querying for posts by view count
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- filter custom field values $min $max
- Restrict WordPress Search to Custom Field
- Show user info in a hovercard [closed]
- How can you include custom post meta in search without calling each key?
- Sort WP_Query with numeric custom field
- Get post ids sorted by meta_key
- querying a custom field
- pre_get_posts : only get posts by wp_usermeta value
- ORDER BY custom field value out of where clause
- wordpress custom loop ascending descending posts by custom field
- 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?
- How to query an out put value?
- List custom queried terms in the edit-tags.php?taxonomy page
- WordPress colorpicker save both hex and RGB
- change order of images attached to post
- Sort posts by clicks on download button