Filter
rpress_fooditem_price_after_html
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#
| Parameter | Type | Description |
|---|---|---|
$formatted_price | string | HTML span containing the price. |
$fooditem_id | int | ID of the menu item. |
$price | string | The filtered price text placed inside the span. |
$price_id | int|false | Variable 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), inrpress_price()
See also#
Was this page helpful?
