Automattic\WooCommerce\Blocks\Domain\Services

DraftOrders::ensure_draft_status_registered()privateWC 1.0

Since it's possible for third party code to clobber the $wp_post_statuses global, we need to do a final check here to make sure the draft post status is registered with the global so that it is not removed by WP_Query status validation checks.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->ensure_draft_status_registered();

Код DraftOrders::ensure_draft_status_registered() WC 8.7.0

private function ensure_draft_status_registered() {
	$is_registered = get_post_stati( [ 'name' => self::DB_STATUS ] );
	if ( empty( $is_registered ) ) {
		register_post_status(
			self::DB_STATUS,
			$this->get_post_status_properties()
		);
	}
}