Filter
rpress_metabox_save_{$field}
On this page
Filters a single menu item meta value after sanitization and before it is saved.
The dynamic part of the name is the meta key being saved. It runs for each key returned by rpress_metabox_fields_save that has a non-empty submitted value, after sanitization and before update_post_meta(). Use it to normalize or validate one specific field.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The sanitized submitted value: a string, or an array for array fields such as rpress_variable_prices. |
Return value#
mixed. The value to store as post meta.
Example#
function my_normalize_price( $value ) {
return number_format( (float) $value, 2, '.', '' );
}
add_filter( 'rpress_metabox_save_rpress_price', 'my_normalize_price' );
Notes#
Not called for empty values (those meta keys are deleted) or for the addons key. RestroPress itself uses this filter on rpress_variable_prices to strip blank price rows.
Source#
Applied in:
includes/admin/fooditems/class-rp-fooditem-metaboxes.php(line 211), inRP_FoodItem_Meta_Boxes::save_meta_boxes()includes/admin/fooditems/metabox.php(line 84), inrpress_fooditem_meta_box_save()
See also#
Was this page helpful?
