我有一个不使用元键的wordpress查询,需要将默认AND
覆盖为OR
代码段:
$args = array(
'post_type' => 'post',
'author__in' => $follow_authors,
'tag_slug__in' => $follows
);
输出语句为...WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (71) ) AND wp_posts.post_author IN (3)...
我找不到让..) AND wp.posts.post_author...
成为OR
答案 0 :(得分:0)
这样的事情应该让你开始:
$meta_query_args = array(
'relation' => 'OR', // Optional, defaults to "AND"
array(
'key' => '_my_custom_key',
'value' => 'Value I am looking for',
'compare' => '='
)
);
$meta_query = new WP_Meta_Query( $meta_query_args );
此处有更深入的解释和示例:https://codex.wordpress.org/Class_Reference/WP_Meta_Query