这是不可能的$wpdb->update()
. 如果您检查source code, 您将看到这些行(第2150-2161行),无法获得OR
其中:
foreach ( $where as $field => $value ) {
if ( is_null( $value[\'value\'] ) ) {
$conditions[] = "`$field` IS NULL";
continue;
}
$conditions[] = "`$field` = " . $value[\'format\'];
$values[] = $value[\'value\'];
}
$fields = implode( \', \', $fields );
$conditions = implode( \' AND \', $conditions );
<小时>
However, 您可以使用编写自己的查询
prepare()
$wpdb->query($wpdb->prepare(
"UPDATE `$tbl_request_log` SET `status` = false WHERE (`id` = %d OR `id` = %d) AND `status` = true",
$req1_id,
$req2_id
));