php-docs-samples: Media Upload doesn't work when Wordpress is installed in a subdirectory.

If Wordpress is in a subdirectory instead of in the root; e.g. www.foo.com/blog/ instead of www.foo.com, then all attempts to upload media to GCS will fail with 403 errors due to a problem in the cookie path.

The fix is to add this line to wp-config.php:

define('COOKIEPATH', '/');

The setup script should notice if Wordpress is being installed in a subdirectory and, if so, add this line. Or perhaps it can be added unconditionally. I haven’t tried this on a Wordpress install in the root directory.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 17 (11 by maintainers)

Most upvoted comments

@tmatsuo We can add the workaround in the README as a quick intermediate step. However longterm this really should be part of the installer script.