Automattic\WooCommerce\Internal\OrderReviews

Endpoint::add_post_state_labelpublicWC 10.8.0

Label the Review Order page in the admin Pages list ("— Review Order Page"), mirroring how WC_Admin_Post_Types labels Shop / Cart / Checkout / My account so editors can spot it at a glance.

Method of the class: Endpoint{}

No Hooks.

Returns

Array|Mixed.

Usage

$Endpoint = new Endpoint();
$Endpoint->add_post_state_label( $post_states, $post );
$post_states(array<string,string>|mixed) (required)
Existing post-state labels keyed by id.
$post(WP_Post|mixed) (required)
Current post being listed.

Changelog

Since 10.8.0 Introduced.

Endpoint::add_post_state_label() code WC 10.8.1

public function add_post_state_label( $post_states, $post ) {
	if ( ! is_array( $post_states ) || ! $post instanceof \WP_Post ) {
		return $post_states;
	}
	$page_id = (int) wc_get_page_id( self::PAGE_KEY );
	if ( $page_id > 0 && $page_id === (int) $post->ID ) {
		$post_states['wc_page_for_review_order'] = __( 'Review Order Page', 'woocommerce' );
	}
	return $post_states;
}