Filter
rpress_{$currency}_currency_filter_before
On this page
Filters the price string when the currency symbol is placed before the amount.
Runs in rpress_currency_filter when the currency_position setting is 'before'. The hook name includes the lowercased currency code, for example rpress_usd_currency_filter_before. Use it to change how a specific currency is displayed.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$formatted | string | Price with the currency symbol or code placed before the amount. |
$currency | string | Uppercase currency code, such as USD. |
$price | string | Formatted amount without the currency and without a leading minus sign. |
Return value#
string. The formatted price.
Example#
function my_usd_currency_before( $formatted, $currency, $price ) {
return 'US$' . $price;
}
add_filter( 'rpress_usd_currency_filter_before', 'my_usd_currency_before', 10, 3 );
Notes#
A leading minus sign for negative prices is added after this filter runs.
Source#
Applied in:
includes/formatting.php(line 209), inrpress_currency_filter()
See also#
Was this page helpful?
