Skip to content
Docs
Get RestroPress

Action

rpress_duplicate_fooditem

Updated
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#

ParameterTypeDescription
$new_idintThe ID of the newly created draft menu item.
$post_idintThe 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), in rpress_handle_duplicate_fooditem()
Was this page helpful?