How to install plugins on localhost

We like to develop our WordPress sites on a localhost (for example with XAMPP). Working locally is great: it’s a lot faster, we can test on different configurations, we can use versioning software and there are less risks. We only noticed a lot of problems with installing plugins from within the WP Plugin page.

Enter FTP credentials (Connection Information screen)

It is possible to search within the WordPress plugin repository, but when we want to install a plugin we got the “Connection Information” screen and we’re asked to enter our FTP credentials. Most of the times this is no problem at all, but when we work on a localhost we don’t always have FTP access. At first we downloaded and installed the plugins manually from the WordPress plugin repository but that took a lot of time while updating or installing multiple plugins.

After a lot of searching we came to the perfect solution. It’s possible to use a different filesystem method and no longer use the FTP connection. You can add the following code to your WP-config.php to let WordPress use the direct Filesystem Method (FS_METHOD). This will easily let you install and update plugins and themes from the repository on your local server.

define('FS_METHOD', 'direct');

Hopefully this will solve your issues when installing or updating plugins on your localhost! Did this work for you? Please leave your comments below.