How To Fix WordPress Asking For FTP Credentials – 3 Methods
You’ve tried it. Either you want to update a plugin or a theme or maybe even install a new plugin or theme, and then WordPress prompts you for your FTP credentials.
To fix this, the easiest way is to force WordPress to use the file system directly. This you achieve by signing in to your WordPress website via an FTP client. Edit the file wp-config.php, and then anywhere at the top, add define(‘FS_METHOD’, ‘direct’);
Now WordPress won’t ask for your FTP credentials. If this doesn’t work, I have 2 other methods, but before I dive into them, let me elaborate on the first method.
Method 1: Change WordPress To Use Filesystem
To sum up, when you want to update a plugin or a theme. Or you want to install a new plugin or theme. WordPress will prompt you for your FTP credentials if you don’t have the right file permissions on your server.
The easiest way is to sign in to your WordPress website server via a file manager or an FTP client, and you can use FileZilla. You can find your FTP credentials with your host, and you can ask them if you can’t find them
Then edit the file with the name wp-config.php, and search for FS_METHOD in the file. If it’s not present, then you add the following line around the top of the file.
define('FS_METHOD', 'direct');
This will force WordPress to use the file system instead of prompting you for FTP credentials.
[cboxarea id=”cbox-DZ7YzH84qT48YAf1″]
If this doesn’t work, then you can try and add the following lines to try and manipulate the file permissions on your server.
define('FS_CHMOD_DIR', 0755);
define('FS_CHMOD_FILE', 0644);
Method 2: Add Your FTP Credentials In wp-config.php
If method 1 doesn’t solve your issue, and WordPress still asks for your FTP credentials, then you can add your FTP credentials in wp-config.php so you don’t have to write them every single time you update or install a plugin or a theme.
Simply edit the same file wp-config.php, and again around the top, add the following lines of code:
define('FTP_USER', 'YOUR_FTP_USERNAME');
define('FTP_PASS', 'YOUR_FTP_PASSWORD');
define('FTP_HOST', 'FTP.DOMAIN.COM');
Replace the values on the right side with your values: Your FTP username, FTP password and the URL to your FTP server.
All this information can be found at your hosting provider.
This should do the job, but if you don’t want to add this information method, 3 is another solution you can use.
Method 3: Change File Permissions On Your Server
WordPress is prompting you for your FTP credentials because the file permissions are incorrect for your WordPress setup.
This you can fix in 2 ways. You can sign in via FileZilla or another FTP client. Right-click on the folder where your WordPress installation is. Click on file permissions, set it to 755, and then ensure it checkmarks recursive in all subfolders.
If this doesn’t work and you have access to run commands on your server, then you can fun the following command:
sudo chown -R www-data:www-data <folder_path_to_your_wordpress>
Remember to restart Apache after this:
sudo /etc/init.d/apache2 restart
As a last solution, you can ask your host to fix the file permissions and ensure your FTP user has ownership of all files. This will also fix the issue where WordPress is asking for FTP credentials.
FAQ
Why does WordPress need FTP access?
WordPress is asking for FTP credentials because the file permissions on your server have been changed. Unfortunately, this means WordPress can no longer write to the files, which blocks WordPress from updating and installing new plugins and themes.
What are my WordPress FTP credentials?
You can always find your FTP credentials at your hosting provider. If the password is hidden, then you can securely reset it. It won’t do any harm to your WordPress website.
Do I need an FTP client for WordPress?
No, you don’t need an FTP client. Sometimes it’ll make your life easier, but you can do everything in the WordPress environment without an FTP client.