Form to Add Posts to Custom Post Type (Again)

You need to put the form processing part of the code at the top of the page before anything else and

wp_redirect(get_permalink($pid)); exit;

Right after

   

$pid = wp_insert_post($new_post); 

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