How to create Uploads folder with WordPress install with Bluehost

If you have installed WordPress with Bluehost hosting, it’s a well-known issue that the uploads folder will not be present. When you install any theme, you may encounter some errors if you don’t have the “uploads” folder.

Apparently, when you install WordPress using Bluehost cPanel, this folder won’t be created. Though this issue doesn’t come with Hostgator.

So, how to fix this issue?

Create uploads folder inside wp-content if not present

You need to add the below code in your themes functions.php file.

  • Go to wp-content/themes/yourthemename/functions.php
  • Add this code at the bottom of the file. Save the file.


$path_to_directory = ‘path/to/directory’;

if (!file_exists($path_to_directory)) {

mkdir('path/to/directory', 0644, true);

}

NOTE: Replace ‘path/to/directory‘ with your actual website path on the server.

The above line of code creates the uploads directory inside the wp-content directory with chmod 0644 privilege permission. The chmod 0644 sets the permission such that the

  • user/owner can read, write but can’t execute
  • group can read, can’t write, and can’t execute
  • others can read, can’t write, and can’t execute

If chmod 0644 permission creates the upload folder. Change the 0644 to 0755.

NOTE: The chmod 0755 on any directory means the read and execute access for everyone and write access for the owner only. Only the owner is allowed to write the file.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.