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
- Validating Custom Meta Box Values & Required Fields
- Is there a way to set default custom fields when creating a post?
- Add custom objects/entities to WordPress
- query_posts and only show results if a custom field is not empty
- 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
- 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
- Multiplile values checkbox or select in custom meta box
- Adding Properties to User Profile and Displaying in List
- Select category in custom query
- How to use query_posts() with a date filter on a custom field?
- Return category slug / title from category ID
- how to save multiple custom fields for a post in one go?
- Best way to add custom / magic / flutter fields into RSS feed
- Can ordering post list by meta_value cause performance issue?
- Add custom taxonomy under the category title
- How do I query for a post by custom field?
- Escaping Quotes
- How to sort category by custom field value
- How do you create dynamic customised sections in WordPress?
- 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?
- Show 1 post and after a specific date show the next one
- Displaying a checkbox array from advanced custom field
- How to make condition, based on custom fields value?
- 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?
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Custom tables or custom fields?
- Post selector as Custom Field
- 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?
- 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?
- frontend submit post jQuery clone row won’t save
- 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
- Custom meta boxes not saving
- How can I change the publish date based on a custom field?
- How to get all custom fields with some prefix in key?
- Best way to achieve multiple links in a post title
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Get author total post votes from post meta
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Save custom field types with this function…?
- Show posts from category specified using a custom field
- Problem with writting correctly a query posts args in WordPress
- Make separate text boxes for separate WordPress Custom Fields
- Adding re-type email and check it if the email match
- simple fields plugin custom query
- Approach to creating a site with this structure
- Automatic Set Category For A Custom Post Type
- query_posts -> get page_id from custom field
- Save input form on custom field
- When post is updated, custom metadata in text area field is overwritten
- Is it possible in WordPress
- Extend WP_Customize_Control with Multiple Field Control
- custom field functionality
- Custom fields are not displaying in page with multiple loops
- How to add an option to admin to add image that could be used as header?
- Show or hide lang=”ur” in main element
- How can I create more “create attachment” custom field – any idea?
- Adding thumbnails for non-image attachments
- How to add a prefix to existing custom fields over MYSQL query?
- Filtering posts by WORD in custom field
- I would like to display different text on different pages
- Semi-Private Comments + page comments -> is it possible?
- Display agents (custom post type) alphabetically, except one who always shows last
- Add image custom attribute [closed]
- How I can change PayPal IPN ‘custom’ field in woocommerce?
- Google not index my Custom 404 page ?why?