Automattic\WooCommerce\Internal\Admin\Orders

PostsRedirectionController::__construct()publicWC 1.0

Constructor.

Method of the class: PostsRedirectionController{}

No Hooks.

Return

null. Nothing.

Usage

$PostsRedirectionController = new PostsRedirectionController();
$PostsRedirectionController->__construct( $page_controller );
$page_controller(PageController) (required)
Page controller instance. Used to generate links/URLs.

PostsRedirectionController::__construct() code 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();
		}
	);
}