Support » Fixing WordPress » tax_query OR meta_query… possible?

  • 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…


  • The topic ‘tax_query OR meta_query… possible?’ is closed to new replies.