How to fix “enter your FTP credentials” WordPress error

In some WordPress installations, you get the following error while trying to activate or disable plugins:

To perform the requested action, WordPress needs to access to your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

To fix it, open your wp-config.php file in the root of your WordPress install, and change existing  or add the following line to the end of the file:

define('FS_METHOD', "direct");

That should alow you to control plugins without having to enter FTP login details.

A better version yet, is rephrasing the option in the following way:

if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );

This will limit the FS_METHOD only to administrators.

Leave a Comment