Skip to content
Docs
Get RestroPress

Filter

rpress_get_discount_status_label

Updated
On this page

Filters the display label for a discount status.

Runs in RPRESS_Discount::get_status_label(), which maps the expired, inactive and active statuses to translated labels (anything else maps to Active). Use it to relabel statuses on the discounts screen or to add labels for custom statuses.

Available since RestroPress 2.9.

Parameters#

ParameterTypeDescription
$labelstringThe translated status label.
$statusstringThe discount status.
$discount_idintThe discount ID.

Return value#

string. The status label to display.

Example#

function my_get_discount_status_label( $label, $status, $discount_id ) {
	if ( 'expired' === $status ) {
		return __( 'Ended', 'my-plugin' );
	}
	return $label;
}
add_filter( 'rpress_get_discount_status_label', 'my_get_discount_status_label', 10, 3 );

Source#

Applied in:

  • includes/class-rpress-discount.php (line 754), in RPRESS_Discount::get_status_label()
Was this page helpful?