Automattic\WooCommerce\Admin

PageController::get_current_page()publicWC 1.0

Get the current page.

Method of the class: PageController{}

No Hooks.

Return

Array|true|false. Current page or false if not registered with this controller.

Usage

$PageController = new PageController();
$PageController->get_current_page();

PageController::get_current_page() code WC 8.7.0

public function get_current_page() {
	// If 'current_screen' hasn't fired yet, the current page calculation
	// will fail which causes `false` to be returned for all subsquent calls.
	if ( ! did_action( 'current_screen' ) ) {
		_doing_it_wrong( __FUNCTION__, esc_html__( 'Current page retrieval should be called on or after the `current_screen` hook.', 'woocommerce' ), '0.16.0' );
	}

	if ( is_null( $this->current_page ) ) {
		$this->determine_current_page();
	}

	return $this->current_page;
}