Automattic\WooCommerce\Blocks\Domain\Services
DraftOrders::ensure_draft_status_registered() private WC 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.
{} It's a method of the class: DraftOrders{}
No Hooks.
Return
Null. Nothing.
Usage
// private - for code of main (parent) class only $result = $this->ensure_draft_status_registered();
Code of DraftOrders::ensure_draft_status_registered() DraftOrders::ensure draft status registered WC 5.0.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()
);
}
}