In this code snippet i will show how you can set default post author using wordpress when you publish post in Wordpress set current login user as author.
By default WordPress has five user roles. They are Subscriber, Contributor, Author, Editor and Administrator. Each of them has different capabilities and access levels in WordPress where Administrator is the most powerful and Subscriber is the lowest. An Administrator can do almost everything and a Subscriber can do almost nothing!