Skip to content
Docs
Get RestroPress

Filter

rpress_{$currency}_currency_filter_before

Updated
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#

ParameterTypeDescription
$formattedstringPrice with the currency symbol or code placed before the amount.
$currencystringUppercase currency code, such as USD.
$pricestringFormatted 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), in rpress_currency_filter()

See also#

Was this page helpful?