Automattic\WooCommerce\Internal\OrderReviews

Endpoint::render_404privateWC 1.0

Mark the current request as a 404 and load the theme's 404 template.

Fails closed on every gating check so a stale or tampered link cannot disclose order existence.

Method of the class: Endpoint{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->render_404(): void;

Endpoint::render_404() code WC 10.8.1

private function render_404(): void {
	global $wp_query;

	$wp_query->set_404();
	status_header( 404 );
	nocache_headers();

	$template = get_query_template( '404' );
	if ( ! empty( $template ) && file_exists( $template ) ) {
		include $template;
		return;
	}

	// Fallback when the active theme has no 404 template: emit a minimal
	// page so the response body isn't empty.
	printf(
		'<!doctype html><html><head><meta charset="utf-8"><title>%1$s</title></head><body><h1>%1$s</h1></body></html>',
		esc_html__( 'Page not found', 'woocommerce' )
	);
}