// wordpress & cpanel how-tos
Unable to locate WordPress content directory (wp-content): how to fix it
Moved your WordPress blog to a new host and now plugins won't install or update? This error is common after a migration, and you can fix it in a few minutes from cPanel.
What the error looks like
When you install or update a plugin, WordPress shows a message like this:
Unable to locate WordPress Content directory (wp-content).
On some WordPress versions and settings, you may also see Unable to create directory wp-content/uploads, and WordPress may ask for FTP details before it lets you upload plugins. These errors come from the server's settings, usually file ownership and permissions on a Linux server. This tutorial is for beginners who aren't used to editing files in their hosting control panel.
Step 1: Find your FTP details in cPanel
You'll need your FTP username, password and server. Log in to cPanel and click FTP Accounts. You may see more than one FTP user, and that's where people get confused: only one works for this fix. Look for the default account, shown with the person icon, which belongs to your main cPanel user.
Click Configure FTP Client next to it to see the username and the server (host). The password is the same as your cPanel password. Save these details for the next step.
Step 2: Add your FTP details to wp-config.php
- In cPanel, open File Manager.
- Go to your web root (usually
public_html) and turn on Show Hidden Files in the settings. - Find
wp-config.php, select it and click Edit. - Add these lines above the line that says "That's all, stop editing!", with your own details:
define( 'FTP_USER', 'userhere' );
define( 'FTP_PASS', 'passwordhere' );
define( 'FTP_HOST', 'ftphosthere' );The "FTP server" is the same as the "FTP host". Click Save Changes, go back to your WordPress dashboard and update your plugins or WordPress core. It should work now.
You can also use an FTP client like FileZilla. It lets you browse your site's folders, find any file and change permissions easily.
Still getting the error?
Then the problem is in the server settings, which you can't always change yourself. Contact your host's support and tell them WordPress can't write to wp-content; they can fix the file ownership or the PHP settings for you. If this keeps happening, consider a host that manages WordPress for you, so an expert handles the server while you focus on your content. See managed WordPress hosting compared.
FAQ
What causes "Unable to locate WordPress content directory"?
Usually file ownership or permissions on the server after you move WordPress to a new host. WordPress can't write to the wp-content folder directly, so it asks for FTP access or fails to install and update plugins.
Is it safe to put FTP details in wp-config.php?
It works, but it stores your FTP password in a file on the server. Keep wp-config.php protected, use a strong password, and ask your host whether it can fix the file permissions instead, which is the cleaner solution.