WC_Admin_Log_Table_List::get_items_query_where
Get prepared WHERE clause for items query
Method of the class: WC_Admin_Log_Table_List{}
No Hooks.
Returns
String. Prepared WHERE clause for items query.
Usage
// protected - for code of main (parent) or child class $result = $this->get_items_query_where();
Notes
- Global. wpdb.
$wpdb
WC_Admin_Log_Table_List::get_items_query_where() WC Admin Log Table List::get items query where code WC 10.5.0
protected function get_items_query_where() {
global $wpdb;
$where_conditions = array();
$where_values = array();
if ( ! empty( $_REQUEST['level'] ) && WC_Log_Levels::is_valid_level( $_REQUEST['level'] ) ) {
$where_conditions[] = 'level >= %d';
$where_values[] = WC_Log_Levels::get_level_severity( $_REQUEST['level'] );
}
if ( ! empty( $_REQUEST['source'] ) ) {
$where_conditions[] = 'source = %s';
$where_values[] = wc_clean( $_REQUEST['source'] );
}
if ( ! empty( $_REQUEST['s'] ) ) {
$where_conditions[] = 'message like %s';
$where_values[] = '%' . $wpdb->esc_like( wc_clean( wp_unslash( $_REQUEST['s'] ) ) ) . '%';
}
if ( empty( $where_conditions ) ) {
return '';
}
return $wpdb->prepare( 'WHERE 1 = 1 AND ' . implode( ' AND ', $where_conditions ), $where_values );
}