This replacement is great, but I need one for post ID also, not URL.
This is because my custom post type don’t have own URL, only URL parameter (like /dashboard/<CPT-ID> )
But its also much more versatile because people can do anything they want with the ID.
So please can you add also:
$form['return'] = str_replace('%post_id%', $form['post_id'], $form['return']);