Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::convert_status_to_query_value()protectedWC 1.0

Converts a status key into its equivalent comment_approved database column value.

{} It's a method of the class: ReviewsListTable{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->convert_status_to_query_value( $status ) : string;
$status(string) (required)
Status key from ReviewsListTable::get_status_filters().

Code of ReviewsListTable::convert_status_to_query_value() WC 7.1.0

protected function convert_status_to_query_value( string $status ) : string {
	// These keys exactly match the database column.
	if ( in_array( $status, [ 'spam', 'trash' ], true ) ) {
		return $status;
	}

	switch ( $status ) {
		case 'moderated':
			return '0';
		case 'approved':
			return '1';
		default:
			return 'all';
	}
}