Filter
rpress_get_discount_status_label
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#
| Parameter | Type | Description |
|---|---|---|
$label | string | The translated status label. |
$status | string | The discount status. |
$discount_id | int | The 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), inRPRESS_Discount::get_status_label()
Was this page helpful?
