How to declare this function correctly?
Firstly I don’t see $args assigned anywhere. Secondly before displaying in front-end, check if post is created with your values. Little debugging like printing $new_post before insert might give you your issue.