WP_CLI\Iterators
Table::build_where_conditions()
Method of the class: Table{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = Table::build_where_conditions( $where );
- $where (required)
- -
Table::build_where_conditions() Table::build where conditions code WP-CLI 2.8.0-alpha
private static function build_where_conditions( $where ) { global $wpdb; if ( is_array( $where ) ) { $conditions = []; foreach ( $where as $key => $value ) { if ( is_array( $value ) ) { $conditions[] = $key . ' IN (' . esc_sql( implode( ',', $value ) ) . ')'; } elseif ( is_numeric( $key ) ) { $conditions[] = $value; } else { $conditions[] = $key . $wpdb->prepare( ' = %s', $value ); } } $where = implode( ' AND ', $conditions ); } return $where; }