Unable to install wordpress plugins on localhost

When creating WordPress websites I like to do so locally (e.g. XAMPP). Working locally has allot of advantages like faster load speed, being able to load the entire project in the IDE of your choice (code suggestion for your entire project) and the ability to use versioning software (like SVN and GIT). The only problem I had was not being able to install plugins from within the plugin backend page.

Searching through the plugin repository works fine but when you try to install a plugin you’re asked to enter FTP credentials to proceed (the ‘Connection Information’ screen). And because we’re working locally, it’s most likely that we don’t have FTP access to our local server.

Of course you can download the plugin from the wordpress.org online repository and then copy the files to your local plugin directory, but you don’t have to! We can simply add the following code to our wp-config.php to let WordPress use a different filesystem method than FTP.

define('FS_METHOD', 'direct');

Setting the ‘FS_METHOD’ to ‘direct’ will also allow you to update WordPress Core and install themes from the theme repository locally. I’d love to know if this helped you or if you have a question, so please leave a comment below.