Following my last little article on WordPress plugins I can’t live without, it made me remember something I’d done recently to my WordPress installation. If your a WordPress user which runs WordPress on a server rather than a wordpress.com hosted account then you’ll understand that each time you install or remove a plugin you have to provide FTP information in order for WordPress to correctly locate the wp-content/plugins directory and get authorization to add or remove a plugin.
This while small can become quite tedious, but did you know you can get WordPress to remember the FTP information forever? Which means you won’t have to constantly keep typing in your password each time you add or remove a plugin!
It’s nothing complicated, all you need to do is locate your wp-config.php file which is located within the first directory of your wordpress installation. For example if your whole website runs off WordPress your wp-config.php file will be located within the public_html folder. If you have set up your wordpress installation within a sub directory such as blog so you URL is www.mywebsite/blog/ then the wp-config.php will be within the first level of that directory. Once you’ve located the wp-config.php file open it up in some form of text editor, you edit it via your webhost control panel or over FTP it’s up to you.
Now once you’ve got your wp-config.php file open this is where I will say, DON’T CHANGE ANYTHING. This file (while small) controls part of your WordPress installation and changing any part of it can stuff up your WordPress powered website unless you know what your doing. Scared you enough? Continue reading. Luckily we won’t be changing anything just adding a couple of lines to the file. Scroll down to the bottom of the wp-config.php file until you see ?> This represents the closing tag of a PHP script. We are going to be adding a couple of lines just before the closing tag. Make sure it’s before and not after the closing tag otherwise it won’t work. Add the following just before the end PHP tag:
/* WordPress FTP Information (For removing the constant password request on plugin install and removal) */ define("FTP_HOST", "mywebsite.com"); define("FTP_USER", "username"); define("FTP_PASS", "mypassword");
You will need to change the example data to your settings. Your FTP address is typically just your website URL and 9 times out of 10 your FTP username is what you webhost control panel username is. Usually webhost control panel usernames are 7 letters or less, and your password, well only you know that! If you are unsure of your FTP account details contact your host, im sure they’d happily enlighten you!
Save your changes to your wp-config.php file and thats it. You can now go ahead and test out your addition by installing a plugin using the Add new feature (Only in WordPress 2.7 +) you should fine that the plugin will install without requesting your FTP password. This addition to your wp-config.php file will also remove the need for you to enter a password when you delete a plugin also.
Hope my quick tip is useful to all you WordPress users out there!