The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

tax_query OR meta_query... possible? (1 post)

  1. kettlewell
    Posted 4 years ago #

    It appears that when creating a custom query, the operator that's applied to a tax_query and a meta_query is 'AND'.

    Is it possible to have a query that selects something from a category (tax_query) OR from a custom field (meta_query) ?

    $args =  array (
    		  'post_type' => 'post',
    		  'meta_query' => array (
    			      'key' => 'key_name',
    			      'value' => 'val_name'
                       'tax_query' => array (
                                     'taxonomy' => 'category',
    			         'field' => 'slug',
    			         'terms' => array( 'quotes' )

    I'm finding that this query provides me with a result of a category AND a custom field... but I'd like to have a category OR a custom field...


Topic Closed

This topic has been closed to new replies.

About this Topic