You’re almost there. Here’s the part that is setting the author of post to user with ID = 1:
'post_author' => 1,
'post_status' => 'publish',
'post_type' => 'testimonial',
'author' => $current_user->ID,
You even try to set the author to $current_user, but you don’t initiate this variable anywhere in your code and you set author
field instead of post_author
.
So here’s the correct version:
'post_author' => get_current_user_id(),
'post_status' => 'publish',
'post_type' => 'testimonial',