Since version 3.1 WP got much enhanced querying of custom fields. If I got the code right your query should be something like this:
query_posts(array(
'category__and' => array(1,2,3),
'meta_query' => array(
array(
'key' => 'length',
'value' => array($min_length, $max_length),
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
),
));
See:
Related Posts:
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- Custom query with orderby meta_value of custom field
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- what is the correct way to compare dates in a WP query_posts meta_query
- Add validation and error handling when saving custom fields?
- Validating Custom Meta Box Values & Required Fields
- Is there a way to set default custom fields when creating a post?
- Query Posts or Get Posts by custom fields, possible?
- Add custom objects/entities to WordPress
- Adding another state (spam, reject, approve) to wordpress comments?
- query_posts and only show results if a custom field is not empty
- Filter archive.php by custom meta
- Edit Custom Database Tables in WordPress
- Filter results with custom field values and dropdown
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Making a configurable field translatable
- Is there a way to do multiple ordering on a multiple meta_query?
- Order posts by custom field and if custom field is empty return remaining posts
- Check before publishing, if already exist post with current custom field value
- Add field to posts (checkbox) that only one post can have
- How to customize default wordpress editor?
- Custom Fields Bulk Edit
- Custom Page Template [closed]
- How to make custom comment fields required and message field not required
- Problem in custom meta boxes
- How to show custom field’s value under post/page title in wp-admin
- Query on custom field count?
- Multiplile values checkbox or select in custom meta box
- Adding Properties to User Profile and Displaying in List
- Select category in custom query
- ajax delete value from custom field array
- How do I read the value of a custom field of the page?
- How to use query_posts() with a date filter on a custom field?
- Return category slug / title from category ID
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- how to save multiple custom fields for a post in one go?
- get_post_meta in sitewide tags plugin fails to return value for custom fields
- Best way to add custom / magic / flutter fields into RSS feed
- meta_value_num sort glitch
- Can ordering post list by meta_value cause performance issue?
- Order by value in serialized custom field
- Add custom taxonomy under the category title
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How do I query for a post by custom field?
- meta query not showing any results?
- Escaping Quotes
- Insert attachment ID in custom field from media uploader
- How to sort category by custom field value
- How do you create dynamic customised sections in WordPress?
- Delete all custom fields at once?
- how can i use custom field in query post
- How to insert content from another Custom Post type into Post?
- using multiple meta_key and meta_value in query_posts
- Query post order by post and desc not working
- How can I sort homepage by a meta value?
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- Order query by meta_value with multiple custom fields
- Better Method for Multiple Meta Boxes
- Show 1 post and after a specific date show the next one
- query usermeta from custom field
- custom avatar removal
- Displaying a checkbox array from advanced custom field
- WP 3.1 meta_query for multiple custom field values
- How to make condition, based on custom fields value?
- Sort custom field by post
- meta_compare seems to be treating values as strings instead of integers as expected
- Send email with custom fields after new draft is saved or new post published
- How to get categories with posts by custom field value?
- How do i add custom fields to my themes template file?
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Custom tables or custom fields?
- Post selector as Custom Field
- Change order of posts
- filter custom field values $min $max
- I need a “Choose from existing content” popin
- For homepage images (for small business website), is it better to use custom fields or post_thumbnail?
- Redirect to another page using contact form 7? [closed]
- query posts custom field calculation value
- WP Query – Is this correct?
- Query_posts with custom field meta value
- Unable to get specific value from post meta
- Get categories query not working in function.php
- How to remove custom fields from the selector?
- How can I hide custom field from users used for caching response from external api?
- How to query an out put value?
- Check & remove special characters in a field?
- Let’s Create Custom Field Template Documentation
- How can I combine this php statement to get the results of multiple variable inputs?
- if in category but only with post meta
- frontend submit post jQuery clone row won’t save
- Is there a way to set default custom fields when creating a new post?
- Meta_query ‘compare’ => ‘LIKE’ not working?
- MetaBox not saving after empty
- query_posts with meta_value
- Custom search SQL Query to add custom field in result
- How to put forward a blog post
- Get text from user and display it on page
- Custom Fields Question
- Showing Custom Fields on Parent Page
- How can I output the custom fields wrapping with HTML