I would saythose are two different cases.
If I understood codex correctly and didn’t miss anything, meta_value
and meta_value_num
are valid values for orderby
, but using meta field name / key directly isn’t. You would need to add the field name as meta_key
parameter to the query args.
orderby
defaults to date
which I think might cause similar results for the two setups.
Related codex entry https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
If meta key is a valid value for orderby
, then that is something new to me. Thanks!
Related Posts:
- When to use WP_query(), query_posts() and pre_get_posts
- How to get an array of post data from wp_query result?
- How to only display posts whose meta_value field is not empty?
- How to print the excuted sql right after its execution
- WP query taxonomy input differs to output?
- How to add taxonomy filter on the query fly?
- What exactly does the ‘s’ parameter search for in WP queries?
- WP_Query min and max values
- post_type is ignored by WP_Query when ‘tag’ argument is included
- How to query posts of standard post format. For real
- Orderby menu_order doesn’t work
- WP_Query by Category Name
- assign 2 $args to one wp_query
- WP_Query OR clause for tax_query and keywords
- Calling a custom excerpt function in a local loop
- Transient pagination not working properly
- query posts in functions.php and update a field
- get_posts() seemingly ignoring post_type
- If orderby parameter using pre_get_posts is the same for multiple posts what fallback does the query use?
- Which filter/action hook gets triggered after a query has been performed?
- Use meta_query to display events by date in custom field
- Calling WP_Query with the same args in two different places produces two different results
- tax_query OR with empty result returns all posts
- WP_Query Order by Specific Post ID First
- Custom Query – show first post twice?
- Next/Prev posts on same page
- Using one WP_Query object within the loop of another WP_Query object
- Order by slug in get_terms with multiple taxonomies
- Creating query to show which editor (classic or block) was last used to edit a post/page
- Tax query clause inside a meta query clause?
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- is_tax() function not working as expected
- Getting the current post number / make posts increment
- Optional Meta Query
- Set conditional on template based on referring page slug
- Multiple If Else with WP Query in WordPress
- Serve specific “template” page at any URL that ends in its slug
- WordPress pagination not working using WP_Query
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- posts_per_page not working for first page of pagination
- WP_Query – Exclude Posts
- Add class to first post in custom loop using post_class filter
- echo a specific meta_key queried through a custom post
- WP_Query with meta_query dosen’t return results
- Get latest post revision with wp-query
- date_query seems to be ignored by wp_query
- How to show more post at a given category?
- WP_Query returns posts_per_page + 1 every time
- Merge two search functions for custom post type
- Filter Custom Taxonomy Posts
- Config.php issue in WordPress
- Is it possible to query from external database? [duplicate]
- problems with comments_number()
- Trying to retrieve random post, getting a page
- WP_Query freezing
- WP_Query to output chosen term and posts with no term assigned
- Need to add onclick javascript at backend of my wordpress site
- WP_Query by keyword OR post tag
- Get a list of ACF Repeater-Fields as array
- query_vars empty when using custom url with custom rewrite rule
- Post archive for certain post format
- Issue with data array format
- Attempt to display site authors in a carousel – User Image not Outputting inside li tags
- Add AJAX “Load more” on custom query block
- problem with the loop
- Why my query is not “Main_query”?
- Filter sub-category from checkbox form
- Meta Box WP_Query array for showing items with a certain relationship
- Multi-layered WP_Query
- `offset` WP_Query argument dont work via `pre_get_posts`
- Function the_posts_pagination() not compatible with WP_Query arguments
- Facing problem with tax_query results
- How to add a “base” filter for all posts visible to visitors on the site?
- Pagination of custom page with custom fields query
- WP_Query() not filtering posts for category
- wp query search multi terms
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- Woocommerce featured products query no longer working
- add action for wordpress query at a specific position
- WordPress post_status and meta_query
- How to query wordpress with array of meta_values?
- Updating an intensive wp_query result once daily
- Custom WP_query and integrating into theme file
- Custom query return
- WP_Query: Meta_Query with serialized value (or a workaround)
- Query All Attachments and Order by Parent Publish Date
- Filter custom post type by custom taxomony
- Query post Pagination Problem
- Why does order ASC break offset in WP_Query?
- new WP_query using custom fields
- Having Trouble Running Query From Shortcode Using Tribe’s Events Plugin
- Change ‘post_modify’ with a query
- An archive page without post format (just standard post)
- Pull Instagram images into an existing loop?
- Pagination showing same posts despite changing page
- Query custom post types by meta field in a term from custom taxonomy
- Filtering product search results using tags
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)