Why is save_post hook being called twice despite all my efforts?

save_post becomes unwieldy under Gutenberg, in my experience. It fires at least twice, and none of the checks you have in place will distinguish between instances.

I would consider replacing it with wp_after_insert_post, which was introduced into core for this very reason.

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