When WordPress asks for your FTP credentials while installing plugins, it usually means that it doesn’t have the necessary permissions to write files directly. To resolve this issue, you can either modify the file permissions or configure WordPress to use the direct filesystem method.
Modify file permissions:
Connect to your server using an FTP client or File Manager in your hosting control panel, and change the file permissions of the wp-content directory to 755 or 775. This should allow WordPress to install plugins without asking for your FTP credentials. However, be cautious when changing file permissions, as setting incorrect permissions can cause security vulnerabilities.
Configure WordPress to use the direct filesystem method:
You can force WordPress to use the direct filesystem method by adding a line of code to your wp-config.php file.
- Log in to your WordPress admin dashboard.
- Go to “Appearance” > “Theme Editor.”
- In the right sidebar, locate and click on the “wp-config.php” file. If you can’t find it in the Theme Editor, you may need to access it through your hosting control panel or an FTP client.
- Add the following code snippet above the line that says, “/* That’s all, stop editing! Happy publishing. */”:
define('FS_METHOD', 'direct');
- Click “Update File” to save the changes.
Now WordPress should be able to install plugins without asking for your FTP credentials.
Note: It’s important to ensure that your server is properly configured and secure before using the direct filesystem method, as it may cause security risks if not set up correctly. If you’re unsure about this, contact your hosting provider for assistance.
Always create a backup of your site before making changes to the code, as editing files like wp-config.php can have unintended consequences if not done correctly.