WordPress cannot create the folder for a plugin, theme or update
Could not create directory.Short answer
WordPress tries to create a folder under wp-content for the new plugin or theme and the operating system refuses. The web server account cannot write there, or WordPress picked a transfer method that does not fit your host. Check who owns wp-content and its upgrade and plugins folders, then fix ownership or set the filesystem method.
Fix it fast
1Find out which cause you have
Find out which user owns the WordPress files and which user the web server runs as. Compare the owner of wp-content with the account PHP runs under.
ls -ld wp-content wp-content/plugins wp-content/upgrade ls -l wp-config.php2Match what you see, then jump to its fix
- 1
Could not create directory. on every install or update, and wp-content is owned by another user (often root or an SFTP user).The web server account cannot write to wp-contentFix - 2
A connection-information form asks for FTP credentials, or Could not access filesystem. appears.WordPress cannot use direct file access, so it falls back to FTPFix - 3
The FTP form is used, but the install still fails with Could not create directory. or Filesystem error.FTP settings that do not match the serverFix
- 1
What does the error look like?
Could not create directory.Could not access filesystem.Filesystem error.
Cause 1 of 3
The web server account cannot write to wp-content
1Check
WordPress documents wp-content as the folder intended to be writable by both your user account and the web server process. Look at the owner and mode shown by ls -ld above.
sudo -u www-data test -w wp-content/plugins && echo writable || echo not-writable2Fix
Make the files WordPress must write group-owned by the web server account, and keep directories 755 and files 644 for everything else, as the hardening guide describes. www-data here is an example; use your server's account.
sudo chgrp -R www-data wp-content
sudo find wp-content -type d -exec chmod g+w {} \;3Verify
Try the plugin install again from Plugins, Add New.
ls -ld wp-content wp-content/pluginsConfirmed by developer.wordpress.org
Cause 2 of 3
WordPress cannot use direct file access, so it falls back to FTP
1Check
WordPress writes directly only when the files it creates have the same owner as the WordPress files; otherwise it falls back to ssh2, FTP extension or FTP sockets and shows the form unless credentials are stored.
grep -n "FS_METHOD\|FTP_" wp-config.php2Fix
If you cannot change ownership, tell WordPress to write directly with FS_METHOD in wp-config.php. The docs say to change it only for update problems, and to remove it if it does not help. Or set the FTP constants for a real FTP or SSH account.
// wp-config.php, above the line 'That's all, stop editing!'
define( 'FS_METHOD', 'direct' );3Verify
Reload the admin page: the connection form disappears and the install runs.
grep -n "FS_METHOD" wp-config.phpConfirmed by developer.wordpress.org
Cause 3 of 3
FTP settings that do not match the server
1Check
FTP_BASE and FTP_CONTENT_DIR must be the full paths of the WordPress base and wp-content folders as the FTP account sees them; FTP_HOST is host:port. The docs also note some hosts need FTP_HOST set to localhost.
grep -n "FTP_" wp-config.php2Fix
Correct the paths and host in wp-config.php. If the host uses restrictive permissions on all user files, FS_CHMOD_DIR and FS_CHMOD_FILE override the defaults (octal values with a leading 0, no quotes).
define( 'FTP_HOST', 'localhost' );3Verify
Run the install again; if it still fails, remove the FTP constants again so you are not testing two things.
grep -n "FTP_" wp-config.phpConfirmed by developer.wordpress.org
How do I stop it coming back?
- Pick one ownership scheme for the site and keep it after every deploy: your account owns, the web server account has group write only on wp-content.
- Do not open everything to everyone as a fix; the WordPress hardening guide says plugin files should be writable only by your user account.
- Remove FS_METHOD and the FTP constants again if they did not fix the problem, as the WordPress docs advise.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 3 loads the model but the property is undefined
The model name you are loading is the name of a resource that is already being used: user
CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.
2 causes, each with a fixBack end
CodeIgniter 3 stops with "Your system folder path does not appear to be set correctly"
503 Service Unavailable
CodeIgniter 3's front controller resolves $system_path and then checks that the result is a directory.
3 causes, each with a fix