WordPress asking for FTP credentials on localhost
Unable to Add/Delete plugin in localhost? After you new and shiny localhost installation you go ahead and start cleaning up. Keeping one fallback theme twenty twenty and deleting others. Then you go ahead and try deleting the Hello Dolly plugin and the Akismat plugin which I believe may not have much usage in localhost and you face this issue of unable to delete or install wordpress plugin without error.
try adding the below mentioned code in wp-config.php file which is present in root folder.
define('FS_METHOD','direct');
Share this article

Docker setups hit this a lot when the container user doesn’t match host permissions.
I used to type FTP details into a local WP and feel ridiculous every time. Your fix is the right one.
Setting define(‘FS_METHOD’,’direct’) should be in every local WP checklist.
Same issue after deleting default themes. Glad this post still exists.