I've got a custom publish type known as portfolio along with a custom taxonomy known as build-type (serving as groups)

I'm attempting to query portfolio posts by build-type ID e.g. all Portfolio posts in "Hotels" (id=4 for your taxonomy)

// gets the ID from a custom field to show posts on a specific page   
$buildType = get_post_meta($post->ID, 'build_type_id', true);
// run query
query_posts(array( 
    'post_type' => 'portfolio',
    'showposts' => -1,
    'tax_query' => array(
        'taxonomy' => 'build-type',
        'terms' => $buildType,
        'field' => 'term_id'
    ),
    'orderby' => 'title',
    'order' => 'ASC'
));

Presently it's calling all portfolio posts and not simply individuals using the build-type ID

For 'field' => 'term_id' must i be utilising term_id, tag_ID, id or something like that else?

Anybody understand how to understand this working?

Thanks ahead of time!

I solved it with the aid of: http://wordpress.stackexchange.com/questions/30476/query-posts-by-custom-taxonomy-id

tax-query must be a range of arrays

The ultimate option would be:

// gets the ID from a custom field to show posts on a specific page
$buildType = get_post_meta($post->ID, 'build_type_id', true);
// run query
query_posts(array( 
    'post_type' => 'portfolio',
    'showposts' => -1,
    'tax_query' => array(
        array(
            'taxonomy' => 'build-type',
            'terms' => $buildType,
            'field' => 'term_id',
        )
    ),
    'orderby' => 'title',
    'order' => 'ASC' )
);

On github here:

https://gist.github.com/1275191

I am not really a Wordpress-gury and that i have invested hrs and hrs attempting to solve exactly the same problem. Eventually I discovered this web site publish: http://richardsweeney.com/blog/wordpress-3-0-custom-queries-post-types-and-taxonomies/

The reply is somewhat semi-bad: apparently you cannot filter such as this for custom publish types (it is simply feasible for posts), the industry shame!

Things I did work was this:

$args['custom_tax'] = 'custom_tax_slug' query_posts($args)

Hope it will help!

//Mike