WordPress.org

Support

Support » How-To and Troubleshooting » tax_query OR meta_query… possible?

tax_query OR meta_query… possible?

  • kettlewell
    Member

    @kettlewell

    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 (
    			array(
    			      'key' => 'key_name',
    			      'value' => 'val_name'
    			      )
    			)
                       'tax_query' => array (
                                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…

    possible?

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