Action
rpress_duplicate_fooditem
On this page
Fires after a menu item has been duplicated from the Menu Items list.
Runs inside the duplicate handler once the new draft menu item has been created and its post meta, featured image and taxonomy terms have been copied from the original. The user is redirected to the new item's edit screen immediately afterwards.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$new_id | int | The ID of the newly created draft menu item. |
$post_id | int | The ID of the original menu item that was duplicated. |
Example#
function my_after_duplicate_fooditem( $new_id, $post_id ) {
// Do not carry a unique code over to the copy.
delete_post_meta( $new_id, 'my_unique_code' );
}
add_action( 'rpress_duplicate_fooditem', 'my_after_duplicate_fooditem', 10, 2 );
Notes#
All meta keys are copied verbatim, so per-item unique values stored by extensions should be cleared or regenerated here.
Source#
Fired from:
includes/admin/fooditems/dashboard-columns.php(line 422), inrpress_handle_duplicate_fooditem()
Was this page helpful?
