after wp_insert_post need to get the post id

$post_ID = wp_insert_post($post);

… should work, as you mentioned. From the Codex:

Returns the ID of the post if the post is successfully added to the database. On failure, it returns 0 if $wp_error is set to false, or a WP_Error object if $wp_error is set to true.

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