How can I connect to a second database and still be able to use wp functions like get_post_types()?

How can I connect to a second database and still be able to use wp functions like get_post_types()?

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