WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. kettlewell
    Member
    Posted 2 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 (
    			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?

Topic Closed

This topic has been closed to new replies.

About this Topic