Solved by:
//Check and set/unset user to able the script to run as admin
wp_set_current_user(1);
$link = get_edit_post_link($post_to_private->ID);
wp_set_current_user(0);
Thanks Sally CJ,
Solved by:
//Check and set/unset user to able the script to run as admin
wp_set_current_user(1);
$link = get_edit_post_link($post_to_private->ID);
wp_set_current_user(0);
Thanks Sally CJ,