Adding a new user from the front end

You just need to reorder your function. Create your user before you enter your post, then the 'post_author' => $user_id field will actually have a value.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)