Enfold Theme on Hosted Windows Server: “An error occurred while updating Enfold: Could not create directory.”

I have several sites that use Windows hosting and presumably any of these would be affected by this problem. Anyone that’s tried to organize a Windows folder structure beyond a purely flat hierarchy has run into the 255-character* limit on file paths. You’re okay if you create the 255-character folder structure/file path:

“c:\users\turboAwesome\desktop\organizedFolders\folderLevel1\folderLevel2\folderLevel3\folderLevel4\Im super organized and detailed I use the filename and folder structure to describe the contents of my files and folders when we could be using metadata.doc”

…but add one letter to it and Windows won’t let you create the file. That’s what’s happening when the Enfold theme updater is trying to unpack the installation files. To fix this, go to wp-admin/includes/file.php and replace

$tmpfname = wp_tempnam($url);

with

$tmpfname = wp_tempnam(parse_url($url, PHP_URL_PATH));

This worked for me, but it might now work for you – don’t do this if you’re not comfortable editing your WordPress backend files. Probably should make a backup of your site, too, before updating your theme – consider using UpdraftPlus.

I did not come up with this solution – all credit to user Hyperopic that posted this solution at Kriesi, paraphrased and reposted here so I can find it quickly next time I have to update Enfold. Original post HERE.

* I always remember this issue happening after 255 characters, but I guess it’s 260 characters now. Which means you super-organized and detail-oriented file-namers get 2% more characters to annoy people with than I originally thought.