我有Field Name: "participants"
的自定义字段Field Type: "User"
。
我想在元查询中使用“NOT IN”,但它不起作用。
$getUid = $_REQUEST['uid'];
$args = [
'post_type' => 'polls',
'post_status' => 'publish',
'meta_query' => [
'relation' => 'AND',
[
'key' => 'participants',
'value' => [$getUid],
'compare' => "NOT IN"
]
]
];
$the_query = new WP_Query($args);
return $the_query;
答案 0 :(得分:0)
使用此代码并确保您在$ REQUEST ['uid']
中获得价值WITH
-- CTE to generate the same data
tree AS (
SELECT 1 AS node, 0 AS parent
UNION ALL SELECT 2, 1
UNION ALL SELECT 3, 1
UNION ALL SELECT 4, 2
UNION ALL SELECT 5, 2
UNION ALL SELECT 6, 3
UNION ALL SELECT 7, 3
)
SELECT
node,
parent,
DENSE_RANK() OVER (ORDER BY parent) AS your_rank
FROM tree;