Researching more, I got it to work with the following code
$post = array(
'posts_per_page' => 10,
'post_type' => 'post',
'tax_query' => array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'category-1'
),
'meta_query' => array(
array(
'key' => 'custom-key',
'value' => array(1,100),
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
)
),
'meta_key' => 'custom-key',
'orderby' => 'meta_value',
'order' => 'ASC'
);
Reference: http://www.wphub.com/use-meta_query-query-posts-postmeta/
Related Posts:
- how to query for meta_value have array
- How to only display posts whose meta_value field is not empty?
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- What kind of object type is WP_Query?
- How can I save an array from a random post sequence for later use?
- Getting an array out of WPQuery
- WP_Query with meta_value LIKE ‘something%’
- assign 2 $args to one wp_query
- Use Transient API to cache queries for all posts in all categories?
- Sorting meta_value as integer doesn’t work
- WP Meta Query for some meta (array) values
- meta_query with array as value
- Placing a div or img in between a post array using WP Query [closed]
- Show one post per author and limit query to 8 posts
- Add a default meta_value to new posts
- Ordering by meta_value AND date NOT WORKING with wp_query
- How add a custom posttype name using ACF field to a query post array
- How to use Meta Value Compare in WP_Query For Max and Min numbers
- Custom WP Query from meta_value stored as serialised array
- meta_query works locally but not on live server
- Ordering Posts Type A by Custom Fields of related Post Type B
- How can I get an array of all IDs from the current queried object?
- How can I pick a single post from the latest 3?
- WP Query for variable taxonomies
- Minimize database queries to user tables?
- Custom query for sidebar isn’t returning results
- Need wp_query to return all children and grandchildren
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Adding an array from a query string to a WP meta_query
- new WP_Query to get max price meta value not working
- Query multiple meta values
- Why isn’t my `meta_query` array functioning properly?
- How to orderby multiple meta fields if some fields are empty
- Weird orderby => post__in issue
- Meta_query on same meta key, with diffrenct values
- How to list custom fields as headers and list all pages sharing that custom field under it?
- How to extract specific post
- Meta Query relation “AND” then set array accordingly
- Query all posts if multiple meta key don’t exist
- Get posts by list of post IDs ordered by those IDs?
- Removing duplicate values between two wordpress queries
- Include current post into loop
- Combine results of multiple WP_Query to resemble single WP_Query
- How do I turn these values from MYSQL into an array
- search serialised meta_value for date value?
- Combine 2 arrays in a query parameter
- How can I comment comma-separated array values?
- How do I add a relation parameter to my filter query?
- construct complex queries with WP User Query
- query post by author gender
- Get a list of ACF Repeater-Fields as array
- Related Posts Excluding Certain Categories
- Show posts of an advanced search form
- Query using string from custom field as array value
- Multiple meta query from array
- Category based on post id
- How to get specific string in explode array?
- How to avoid filling up an array each time I run a WP_query?
- Remove from array in WP_Query loop
- Order (by ASC) posts with meta_key so posts without values are last
- Combine relationship posts with existing wp_query
- Counting instances of words in the results of a post query
- Save queried result into database
- sanitize_post() is not sanitizing Post Object
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- WP Query by 4 different taxonomies
- Trouble with serialized metadata
- WP_Query multiple value not working
- What code to use in an array to call the current sub-category?
- WP_User_Query Orderby Not Working
- Loop through array of pages
- Repeat array inside array through while loop
- Sorting Posts by Taxonomy thats not within the query’s $args
- Gather same custom field values in one value in a select tag with wp_query
- Related Post by Tags Code
- date_query problem
- Order posts by more than one variable (meta_key and publish date AND time)
- WP_Query: Meta_Query with serialized value (or a workaround)
- Sorting Posts with meta value not working
- wp_query – Modify $query to include duplicate content
- Iterate through ID’s in loop
- How to get several fields from wp_query?
- Cannot order by in WP_Query
- How to sort a WP_Query array by post_name after an array_merge();
- Issue with WP_Query (need a array of selected ID’s)
- WordPress WP_Query Array Custom search via taxonomies
- Query to get all the posts of more than 2 meta_value having same meta_key?
- WP Query posts__in not working with array
- Sort Posts with custom meta key by default which is currently set as optional
- Dynamically name array in WordPress loop – add/get values
- Dynamically create array from page title
- Order by meta values
- WordPress Query Returning Every Post
- Creating Custom Query
- query_posts, oderby meta_value & print “future” posts
- Get posts by meta value except one post [closed]
- How do I have multiple metaqueries inside one wordpress query
- I want to place a post before all others from an ACF boleen field
- wp_query, calculate with two dates when ‘key’ is text format