keepcalculator

06 Numbers and Powers

WordPress Theme FTP Error: Safe Fix Guide

Card No. 06·43926 · Updated · Standard formula, shown below

If you see an FTP error when trying to install a WordPress theme, it usually means your server is asking for connection details that you don’t have—and you can safely fix it without ever touching FTP. The fix is to add a single line of code to your wp-config.php file that tells WordPress to use the filesystem directly, bypassing the FTP prompt entirely.

Why WordPress Asks for FTP Credentials

WordPress needs to write files to your server when it installs themes, plugins, or updates. On most shared hosting accounts, the web server runs as a different user than the one that owns your WordPress files. When WordPress tries to write a file, the server says “permission denied,” so WordPress falls back to asking for FTP credentials—it will use those to connect back to your site and write the files as the file owner.

This is a common setup on shared hosts like cPanel-based services, where the PHP process runs as “nobody” or “www-data” but your files belong to your cPanel username. The FTP prompt is WordPress’s way of working around that mismatch.

The Safe Fix: Define FS_METHOD in wp-config.php

The cleanest solution is to tell WordPress to use the “direct” filesystem method instead of asking for FTP. This works on most hosts and requires only a small edit to your wp-config.php file.

  1. Connect to your site via FTP or your host’s file manager (you can use the same FTP details your host gave you, or the file manager in cPanel).
  2. Open the file wp-config.php in the root of your WordPress installation.
  3. Look for the line that says /* That's all, stop editing! Happy publishing. */—add the following line just above it:
define('FS_METHOD', 'direct');
  1. Save the file and upload it back if you downloaded it.
  2. Try installing your theme again. The FTP prompt should no longer appear.

This tells WordPress to write files directly using the web server’s user. It’s safe because it only affects how WordPress performs file operations—it doesn’t change your file permissions or expose anything.

What If Direct Method Still Fails?

If you still get a permissions error after setting FS_METHOD to direct, it means the web server user doesn’t have write permission to your WordPress directories. In that case, you need to fix the file ownership or permissions. On most shared hosts, you can do this in cPanel’s File Manager:

  • Select all WordPress folders and files, then click “Permissions” and set directories to 755 and files to 644.
  • If your host uses a different user for PHP (like nobody), you may need to contact support to change the ownership or enable a PHP handler that runs as your cPanel user (such as LSAPI or suPHP).

Changing permissions to 777 is not a good idea—it makes your files world-writable and is a security risk. Stick to 755 for folders and 644 for files.

Alternative: Use FTP Credentials in wp-config.php

If you prefer not to use the direct method, you can store FTP credentials in wp-config.php so WordPress connects automatically. Add these lines above the “stop editing” line:

define('FTP_HOST', 'ftp.example.com');
define('FTP_USER', 'your_ftp_username');
define('FTP_PASS', 'your_ftp_password');

This is less convenient because if your password changes, you must update the file. It also stores your password in plain text, which is a minor security consideration. The direct method is generally cleaner.

Common Misconceptions About the FTP Error

Many people think the FTP error means their site is broken or hacked. It’s not—it’s just WordPress being cautious. Another misconception is that you must use FTP to fix it. You can often fix it through your hosting control panel’s file manager, which doesn’t require a separate FTP client.

Some also believe that installing themes via the WordPress admin is the only way. You can always install a theme manually by uploading the theme folder to /wp-content/themes/ via FTP or file manager. This bypasses the FTP prompt entirely, but you’ll need to repeat it for every theme or plugin.

When Not to Use the Direct Method

On some managed WordPress hosts (like WP Engine or Kinsta), the filesystem is read-only for security. In those environments, the direct method won’t work, and you should install themes through the host’s own dashboard or by uploading a zip file via the admin (which may still work if the host allows it). If you’re on such a host, contact their support for the recommended installation method.

Also, if your site uses a security plugin that restricts file writes, the direct method may conflict. In that case, temporarily disable the plugin, install the theme, then re-enable it.

Frequently Asked Questions

Is it safe to define FS_METHOD as ‘direct’?

Yes, it’s safe on typical shared hosting. It only affects how WordPress writes files—it doesn’t change your file permissions or expose sensitive data. The main risk is if your server has insecure directory permissions, but that’s a separate issue.

Will this fix work for plugin updates too?

Yes, the same FTP prompt appears when updating plugins or the core. Setting FS_METHOD to direct resolves it for all file operations, not just theme installs.

I don’t have FTP access at all. Can I still fix this?

Yes, you can use your hosting control panel’s file manager (like cPanel’s) to edit wp-config.php. Most hosts provide this even if FTP is disabled.

What if I see an error about “Could not create directory” after the fix?

That means the web server user still lacks write permissions. Check your folder permissions (should be 755) and ownership. If that doesn’t help, contact your host—they may need to adjust the PHP handler.

Does this affect site speed or performance?

No, the filesystem method only matters during writes (installs/updates). It has no effect on how your site serves pages to visitors.

What if I’m on Windows hosting?

The same fix applies, but permissions work differently. You may need to give the “IIS_IUSRS” user write permissions to the WordPress folders. The FS_METHOD direct setting still helps.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →