Why insert post function do not set the modified author without administrator panel?

the_modified_author() displays the name of the user whose ID has been stored in the _edit_last post meta field.

If you want to update the ID after another user has updated the post, you can use something like update_post_meta( $post_ID, '_edit_last', get_current_user_id() );. Then the new user’s name will be displayed when using the_modified_author().

Replace get_current_user_id() with a custom user ID if it’s not the current user who’s updating the post.