If you’re moving your WordPress blog to another hosting company, you may find some errors when installing plugins or updating your existing plugins. The most popular error message is will look like the following message.
Unable to locate WordPress Content directory(wp-content).
Or, in other cases, depending on your WordPress version and settings, it can look like the following one.
Unable to create directory wp-content/uploads
These errors related to the WordPress content directory are caused by the parameters in the server, especially, in the of the Linux operating system. But, we will fix this problem together, this tutorial is for beginner bloggers who started their WordPress blog, and who are not familiar with editing files directly in the control panel, of their web hosting accounts.
The error message will look like this:
At the same time, you can’t upload plugins, and WordPress shows an option to use your FTP client to upload files. So, to solve this problem we need to set up the auto update function, directly in the ”wp-config.php” file in the home directory
Steps to fix the wp-content directory problem
Find FTP username and details in the web hosting account
You should know your FTP username and password to use them later, generally, you can find more than one FTP user and here is the problem. But, only one user will work and make the WordPress update working again. So, login to your cPanel account and click on ”FTP Accounts” icons as the following screenshot.
Then, forget all the FTP account, and focus on one account only. You have to find the one with the person’s icon as below.
That’s is your default FTP account that will work with WordPress, when changing hosting. Just find it and then click on ”Configure FTP Clients” at the right. You will get the details of your FTP account username and the server (host).
Your password is the same as your cPanel login. Save your login details and move to the next step.
Edit the wp-config.php file in cPanel
To get started, you have to log into the cPanel, and click on ”File Manager”, or, ”Legacy File Manager”, both will work. You need to open all files in the ”web root” directory, such as the below screenshot.
On the popup window, click on ”Web Root Directory”, and check the ”Show Hidden Files”, as below.
On the next page that will be opened in a new window, locate the file ”wp-config.php”.
To edit the ”wp-config.php” file, you need to select it first, then, you can click the ”Edit” option at the top of the page. Follow the next screenshot example.
Now, you just need to add the following code anywhere in that file that you’ve opened, and change the details with your own.
define( ‘FTP_USER’, ‘userhere’ );
define( ‘FTP_PASS’, ‘passwordhere’ );
define( ‘FTP_HOST’, ‘ftphosthere’ );
”FTP server” is the same as ”FTP host”.
Of course, you need to replace the username, password, and host with yours.
Then, click the ”save changes” button at the top right corner of the page. Now, come back to your WordPress dashboard and update plugins, WordPress core, or do what you want, it should work now.
You can also use an FTP client like Filezilla. It allows you to edit your site directories and find any file. At the same time, you can easily change permissions or anything else.
If for any reason, you still get an error, and you can’t solve it, then, make sure to contact your web hosting provider, for more details and information with their server settings. They will solve the issue, it happens sometimes that the server settings and add-ons cause this problem. Or simply, change to a premium and professional hosting like WP Engine that I recommend, and forget all the problems.
An expert technician will manage your site and the server, and you can focus on your content, instead of wasting the time with settings and fixing settings. Best of all, they are the fastest WordPress hosting and nothing is better than a blazing fast loading time. It helps ranking better in Google and offer a better user experience.