The hook you are after is edit_link
(I couldn't find any documentation). It's fired from inside wp_insert_link
(itself fired whenever a link is created or updated).
The action only passes one argument, the link's ID, to the callback. So you would need to change 2 to 1, on your add_action
call:
add_action( 'save_post', 'mytheme_save_data', 10, 1 );
and remove the $post
variable from your callback function:
function mytheme_save_data($post_id) {
//Your function here
}