You tried to install or delete a plugin or theme in your WordPress blog, but WordPress starts asking for FTP credentials? WordPress asks for the FTP username and Password in order to proceed and perform the action. You can provide these details but this is not the way, WordPress should normally behave.
The first solution you can try is to do this
1. Add the below code in the wp-config.php file (The file is located in the WordPress directory).
2. Save it and try to install or delete the plugin or theme.
If the problem is solved, OK. In most of the cases, this should work.
Otherwise, the real problem is that the user (On the server side) doesn’t have the proper permission to perform the action which includes delete or write permission. This is what causes the issue. If you have implemented the above method and still you are getting an error something like the below one:
Plugin could not be deleted due to an error: Could not fully remove the plugin(s) pluginname/pluginfile.php.
As I said, this is a permission issue.
If you are on Shared Hosting or on a Managed Hosting ask the Hosting Provider for the solution as the error is not from your end. They will surely solve it.
In case you manage the hosting yourself, run the below command to solve the issue.
sudo chown -R www-data:www-data DirectoryADDRESS
Change the “DirectoryADDRESS” in the above command with the directory where your WordPress Content folder is located.
Remember that only wp-content should be writable by www-data. So be careful while executing the above command and change the directory address properly to the location of wp-content.