Sometimes WordPress asking you for ftp details when you are going to add new plugins or themes or going to upgrade. In that case it also restrict you to edit your file or .htaccess file. This problem occur while your WordPress don’t have sufficient or wrong FTP info for accessing your files in server.
To overcome this problem, let your wordpress know about your FTP account by adding those lines in wp-config.php file.
define('FTP_HOST', 'ftp.sitename.com'); define('FTP_USER', 'FTP_Username'); define('FTP_PASS', 'FTP_password'); //*For using SSL Connection set this to true* define('FTP_SSL', true);