Wordpress ftp credentials required error

Solution:

go to wp-config.php and add the following line to the top of the file.

define('FS_METHOD','direct');