WordPress on localhost asking Ftp details while downloading plugins from Dashboard

Many times while on your local server you may have faced this issue. You try downloading and installing a plugin through the Dashboard. Then all of a sudden a screen comes that asks for FTP credentials. If you usually manually extract the plugins zip file in the plugins folder then probably you must have never came across this issue.
So to get rid of this screen and install plugins directly add the following line to your wp-config.php (located in the root of your WordPress installation)

define('FS_METHOD','direct');

That’s it.
However make sure you comment the above line when you deploy your application on production server. As the codex page says
“direct” forces WordPress to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts

Leave a Reply

Your email address will not be published. Required fields are marked *