Filter
rpress_metabox_fields_save
On this page
Filters the list of post meta keys saved from the menu item editor.
Runs when the save handler collects the field names to read from the submitted form. Every key in the list is read from the request and written with update_post_meta(); a key that is missing or empty in the request has its meta deleted. Add the name of any custom form field you want saved automatically.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fields | array | Array of meta key strings to save. |
Return value#
array. The array of meta keys to save.
Example#
function my_save_prep_time_field( $fields ) {
$fields[] = 'my_prep_time';
return $fields;
}
add_filter( 'rpress_metabox_fields_save', 'my_save_prep_time_field' );
Notes#
Called from two save paths with different default lists: RP_FoodItem_Meta_Boxes::metabox_fields() (the active editor) and rpress_fooditem_metabox_fields() (legacy handler). Values are sanitized with sanitize_text_field(), or rpress_sanitize_array() for arrays, before saving.
Source#
Applied in:
includes/admin/fooditems/class-rp-fooditem-metaboxes.php(line 183), inRP_FoodItem_Meta_Boxes::metabox_fields()includes/admin/fooditems/metabox.php(line 41), inrpress_fooditem_metabox_fields()
See also#
rpress_metabox_save_%7B%24field%7Drpress_save_fooditem
Was this page helpful?
