'meta_value_num'
– Order by numeric meta value (available with Version 2.8). Also note that a 'meta_key=keyname'
must also be present in the query. This value allows for numerical sorting as noted above in 'meta_value'
.
Try to use like this :
$args = array (
'post_type' => 'product',
'post__in' => $post_ids,
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => 'tour_price',
'meta_query' => array(
array(
'key' => 'tour_price',
'compare' => '=',
'type' => 'NUMERIC',
)
),
);
Related Posts:
- wordpress query – orderby child post date
- Query by one meta_key and sort by another (possibly NULL value)
- Filter query posts by the count of metas for a meta key
- can’t get query to order posts by acf datepicker
- mySQL query. ORDER BY meta_key
- Order query by post meta value
- Order posts by custom field DATE value
- Ordering by a metadata subfield in WordPress?
- Order by title – but now built in wordpress func, sort the_title
- How to manage a particular “order by” for get_search_query()?
- Order terms by count – missing terms
- JetEngine Query Builder – order by value from repeater
- Order posts ascending from posts in array
- wp query multiple values > display a specific value first
- Order WordPress Query by Custom Field While Still Using Tax_query Argument
- “order” does not affect order of custom query
- Query Posts that have or don’t have a meta_value and order by the same ASC
- Apply ordering args to newly merged queried
- WP_Query orderby meta key/value suddely stopped working
- Ascending & descending posts on same page with IF statement
- How to Optimize WP site for millions of posts
- Get Terms by IDs with IDs order
- How many WordPress SQL Queries per page?
- Slow wp_enqueue_media()
- Advanced Custom Fields – Query Efficiency
- How to display lastest post date in the homepage?
- $query->query_var[‘post_type’] not set for pages
- How to tell if $query_var isset?
- Sorting Grids with Essential Grid and Events Manger
- The use of including upgrade.php when building custom queries
- Get the timout value of a saved transient?
- Does meta_query work within get_posts array?
- Slow meta_query with about 4 milion record on wp_postmeta
- How to show more than 5 posts?
- WordPress Find Duplicate Post By Content
- WP Query Sort by meta value (date)
- How to optimize my query filtering out unwanted data?
- how to query multiple categories in wordpress?
- Disable the MySQL query in the main query
- Strange string in console from wpdb query
- Update slug (URL) of pending posts via phpMyAdmin
- How can I get the query that would be run for the archive page?
- Query metas (and not : query posts by metas)
- Select query for a login
- What’s wrong with my $wpdb prepare?
- where should I reset query after using get_results?
- Getting post data from private page
- Exclude featured image and custom field from this get_attachment query
- wpdb print all post meta
- Form and custom query problem
- Export Specific User data without plugin
- How to write: $wpdb->update having WHERE NOT value pair in the array
- Exclude all sticky posts front page twenty twelve
- wpdb COALESCE won’t work
- get csv of users with user_meta
- Custom SQL Query passing array to WHERE p.id
- Query does not return content
- Query posts dynamic date range
- Parse query filter in wordpress and relation
- get posts by tag to showing in a widget
- Mysql query not working on WordPress 4.2.2
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- Re-sort get_posts query results
- How do I get all results from my query
- Taxonomy filter under Polylang
- WordPress Mysql query and Duplicate
- How to create an overview of posts with the same tag?
- Adjust the order for returned posts
- create a link to a random post within the current category
- How to “orderby” the first array in a meta_query that uses multiply keys?
- Pagination not working on custom post types with rewrite slug
- Change pure SQL database query to WordPress post query?
- Filter orders by modify date
- How to add url parameter to every search query in SearchWp?
- Heavy meta query causing SQL crash
- Custom post type order by post_title
- Sort by postmeta on when searching
- Pulling an ACF into a query
- Speed up search query that searches in post meta?
- modifying main query to query for ranges e.g. from 1999 to 2016
- Querying users by meta value and getting a strange answer
- Help ordering custom query by Title, Ascending
- Using cron for multiple queries
- very slow wordpress query with default query
- Custom Query problem access the values
- Set posts per page for parent category and it’s all children
- Exclude sticky posts from query
- Posts 2 Posts: query connected — orderby problem
- If more than 1 image show post link?
- Rewrite Query_Var URL Parameter with Slug
- How to query different categories on index?
- How to specify what kind of is_single post?
- Can’t See Media Queries with Inspect Tool [closed]
- Print data from wordpress sql query
- Can I create my own query in wordpress with traditional methods?
- How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
- update $wpdb one query
- Admin Post List table Query filtering “WHERE” for custom post type
- How to use a dynamic term id for the query block