Fixing WordPress auto-update

Are you tired of WordPress failing to auto-update, and asking for a username for a FTP server even if every possible files and directories have the right permissions (i.e. are writeable by the web server)? Well, me too. Good news is, after countless hours of browsing and trying every possible solution, I stumble upon one that works. Just add the following line to wp-config.php:

define('FS_METHOD', 'direct');

I tried this out of desperation, and what do you know, the auto-update started to work just fine with this line… Don’t get me started on WordPress’ code logic.