Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_price_after_html

Updated
On this page

Filters the HTML wrapper around a menu item price shown by rpress_price.

Runs after rpress_fooditem_price has produced the final price and it has been placed in a span with the class rpress_price. When rpress_price is called with echo enabled, the output is passed through wp_kses that allows only span elements with class and id attributes, so other markup is removed.

Parameters#

ParameterTypeDescription
$formatted_pricestringHTML span containing the price.
$fooditem_idintID of the menu item.
$pricestringThe filtered price text placed inside the span.
$price_idint|falseVariable price ID, or false when not specified.

Return value#

string. The HTML for the price.

Example#

function my_fooditem_price_html( $formatted_price, $fooditem_id, $price, $price_id ) {
	return '<span class="rpress_price" id="rpress_price_' . absint( $fooditem_id ) . '">' . esc_html( $price ) . '</span>';
}
add_filter( 'rpress_fooditem_price_after_html', 'my_fooditem_price_html', 10, 4 );

Notes#

When the price is echoed, only span elements with class and id attributes survive wp_kses. Returned HTML is not filtered when the function is called with echo disabled.

Source#

Applied in:

  • includes/fooditem-functions.php (line 160), in rpress_price()

See also#

Was this page helpful?