Is there a way to check if the ‘wp_sitemaps_enabled’ is true or false?

The wp_sitemaps_enabled filter is filtering the value returned by WP_Sitemaps::sitemaps_enabled(). You can get the global instance of WP_Sitemaps with wp_sitemaps_get_server, which means you can get the value of sitemaps_enabled() like this:

$sitemaps = wp_sitemaps_get_server();
$enabled  = $sitemaps->sitemaps_enabled();

if ( $enabled ) {

}

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