Introduction

Encountering a scenario where WordPress prompts for FTP credentials can be a common occurrence when attempting to perform various tasks such as updating plugins or themes, or installing new ones. This request typically arises due to permissions-related issues within the WordPress file system. Understanding how to address this situation effectively can streamline your WordPress maintenance processes and ensure smoother updates and installations without the need for FTP credentials.

Let’s see how to fix this issue by using 3 Methods 

Method 1 : Switch WordPress to use the filesystem

WordPress may prompt users for FTP credentials when updating or installing plugins or themes if proper file permissions are not configured on the server. This security measure ensures that only authorised users can modify website files, protecting against unauthorised changes.

Therefore, ensuring correct file permissions is essential to avoid recurring FTP credential requests and streamline the plugin and theme management process in WordPress. By addressing file permission issues, users can enhance the efficiency of updates and installations without the need for manual intervention.

  • Sign in to your wordpress website server via file manager or FileZilla
  • Edit the wp-config.php file and search FS_METHOD
  • If it’s not present, then add this

define(‘FS_METHOD’, ‘direct’);

This will compel WordPress to utilize the file system, eliminating the need for FTP credentials prompts.

  • If this approach proves ineffective, you can attempt to add the following lines to adjust 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 fails to resolve your issue and WordPress continues to request your FTP credentials, you can include your FTP credentials in wp-config.php to avoid entering them repeatedly during plugin or theme updates or installations.

Edit the  file wp-config.php

define(‘FTP_USER’, ‘YOUR_FTP_USERNAME’);

define(‘FTP_PASS’, ‘YOUR_FTP_PASSWORD’);

define(‘FTP_HOST’, ‘FTP.DOMAIN.COM’);

Substitute the placeholders on the right side with your actual values: your FTP username, FTP password, and the URL to your FTP server.

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.

You can resolve this in two ways. First, sign in via FileZilla or another FTP client. Then, right-click on the folder containing your WordPress installation, navigate to file permissions, set it to 755, and ensure it applies recursively to 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 /path/to/wordpress 

Do not forget to restart the web server after making the changes.

Conclusions

In conclusion, encountering WordPress prompts for FTP credentials typically indicates underlying issues with file permissions on the server. By implementing the suggested methods—adjusting file ownership and permissions, defining FTP constants in wp-config.php, or directly modifying file permissions—users can effectively resolve this issue and streamline plugin and theme management processes. Addressing file permission concerns not only eliminates the need for providing FTP credentials but also enhances the overall security and functionality of the WordPress website.