I’ve encountered situations with WordPress installations on hosting where errors occurred due to the missing wp-content/uploads directory.
It appears that the hosting cPanel WordPress installer does not create this folder by default, whereas the installer from HostGator does.
Therefore, I need to add code to my theme to check for the existence of this folder and create it if it’s missing.
In new update it works by default. No changes are required.
In new update it works by default.
No changes are required.
See lessHere is the simple method to make the directory if its not created. /** * recursively create a long directory path */ function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path)) ? mkdir($path) : false; }
Here is the simple method to make the directory if its not created.
See less