WC_REST_Products_Controller::exclude_product_statuses()publicWC 1.0

Exclude product statuses from the query.

Метод класса: WC_REST_Products_Controller{}

Хуков нет.

Возвращает

Строку.

Использование

$WC_REST_Products_Controller = new WC_REST_Products_Controller();
$WC_REST_Products_Controller->exclude_product_statuses( $where );
$where(строка) (обязательный)
Where clause used to search posts.

Код WC_REST_Products_Controller::exclude_product_statuses() WC 9.6.1

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;
}