wp_insert_post at same time as saving post results in 502 Bad Gateway

As pointed out by Otto – it’s going to cause an infinite loop. The solution is to unhook your function before you do a wp_insert_post and then hook it back on afterwards.

remove_action('save_post', 'wysiwyg_save_meta');
wp_insert_post($postArgs);
add_action('save_post', 'wysiwyg_save_meta');

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