Admin sometimes redirects to HTTPS

Finally, after MONTHS I was able to solve it.

Just add

$_SERVER['REQUEST_SCHEME'] = 'http';
$_SERVER['SERVER_PORT'] = 80;

To wp-config.php, preferably before calling wp-settings.php

Thanks to Daan Meijer for this.

PS: It was a server-side error, probably something to do with PHP process manager such as php-fpm or mod_php. The hosting company solved it without the need for the hack above.

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