Automattic\WooCommerce\Internal\RestApi\Routes\V4\Products

Controller::exclude_product_statusespublicWC 1.0

Exclude product statuses from the query.

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

Хуков нет.

Возвращает

Строку.

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

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

Код Controller::exclude_product_statuses() WC 10.5.2

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