Action hooks returning old category instead of new category

Although the hooks are passing you the ID of the changed object in the parameter $object_id, you aren’t using it and are calling get_the_ID instead which will give you the ID of the current loop item.

Try changing your uses of $post_id to $object_id instead.

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