Leverage WP_Rewrite to pre-validate links / detect invalid links

You could call get_post_type with the id to check its type before outputting the permalink.

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