Automattic\WooCommerce\Internal\RestApi\Routes\V4\Products
Controller::exclude_product_statuses
Exclude product statuses from the query.
Method of the class: Controller{}
No Hooks.
Returns
String.
Usage
$Controller = new Controller(); $Controller->exclude_product_statuses( $where );
- $where(string) (required)
- Where clause used to search posts.
Controller::exclude_product_statuses() Controller::exclude product statuses code WC 10.4.3
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;
}