Wordpress WP_Query where clause with OR?

前端 未结 4 498
梦谈多话
梦谈多话 2020-12-21 09:02

hello friends this is my args for WP_Query.

$args = array(\'post_type\' => \'job_listing\');
$args[\'meta_query\']=array(
   \'relation\' => \'OR\',
           


        
4条回答
  •  醉酒成梦
    2020-12-21 09:58

    From the WP_Query Class Reference (link):

    Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays) - you can see this in the second example below. This construct allows you to query multiple taxonomies by using the relation parameter in the first (outer) array to describe the boolean relationship between the taxonomy queries.

    You should add an array('relation' => 'OR') to the beginning of your meta_query array.

提交回复
热议问题