WC_REST_Products_V4_Controller::exclude_product_statuses
Exclude product statuses from the query.
Method of the class: WC_REST_Products_V4_Controller{}
No Hooks.
Returns
String.
Usage
$WC_REST_Products_V4_Controller = new WC_REST_Products_V4_Controller(); $WC_REST_Products_V4_Controller->exclude_product_statuses( $where );
- $where(string) (required)
- Where clause used to search posts.
WC_REST_Products_V4_Controller::exclude_product_statuses() WC REST Products V4 Controller::exclude product statuses code WC 10.3.6
woocommerce/includes/rest-api/Controllers/Version4/Products/class-wc-rest-products-v4-controller.php
public function exclude_product_statuses( $where ) {
if ( ! empty( $this->exclude_status ) && is_array( $this->exclude_status ) ) {
global $wpdb;
$not_in = array();
foreach ( $this->exclude_status as $status_to_exclude ) {
$not_in[] = $wpdb->prepare( '%s', $status_to_exclude );
}
$not_in = join( ', ', $not_in );
return $where . " AND $wpdb->posts.post_status NOT IN ( $not_in )";
}
return $where;
}