Automattic\WooCommerce\Internal\Admin\Orders

PostsRedirectionController::__construct()publicWC 1.0

Constructor.

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

Хуков нет.

Возвращает

null. Ничего.

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

$PostsRedirectionController = new PostsRedirectionController();
$PostsRedirectionController->__construct( $page_controller );
$page_controller(PageController) (обязательный)
Page controller instance. Used to generate links/URLs.

Код PostsRedirectionController::__construct() WC 7.1.0

public function __construct( PageController $page_controller ) {
	$this->page_controller = $page_controller;

	if ( ! wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() ) {
		return;
	}

	add_action(
		'load-edit.php',
		function() {
			$this->maybe_redirect_to_orders_page();
		}
	);

	add_action(
		'load-post-new.php',
		function() {
			$this->maybe_redirect_to_new_order_page();
		}
	);

	add_action(
		'load-post.php',
		function() {
			$this->maybe_redirect_to_edit_order_page();
		}
	);
}