We have chosen to use Google Cloud Storage for our media files (images and pdfs).

When an editor uploads a media file via wordpress media functionality, that file is stored in a Google Cloud Storage bucket. You can read more about Google Cloud Storage at its documentation

In the wordpress side, we use a plugin called wp-stateless . One of the features of wp-stateless is cache busting

This causes rarely the following problem: An editor uploads a media file (a pdf or an image), shares the url for that media file, and then discovers a mistake and wants to change it.

With cache busting used, if the editor uploads the file again, it will have a new url, and the old file will continue to be available.

There are three solutions to that:

  1. Editors be more careful. Think of your pdfs as printed material. Once you sent it to the printing press and it gets printed, there is no taking back.
  2. Do not share the url of the document (or the image), but share instead the wordpress page that encloses it. For every media file you upload a page is automaticall generated.
    • Example: I just uploaded a pdf called Lorem Ipsum. WordPress created an attachment page for it: https://planet4.greenpeace.org/lorem-ipsum/ . I can share this instead of the actual pdf url. If a mistake has happened and I need to share a different pdf, I do the following:
      • I upload the new PDF,
      • I find the new pdf attachment page url
      • I use the redirection plugin to redirect from the old url to the new url
  3. If I did not check my document well, and I also shared the url of the file instead of the attachment page, there is always a (painfull and manual) way to fix it. Open a ticket with Global Support to replace the file in Google Cloud storage with the new one, maintaining the url. Open a ticket by writting to [email protected], and include the url of the old file and attach the new file.


Instructions for Global Support:

Lets say a user is asking you to replace the image


with a new version

  1. Go to Google Cloud Storage (while logged in with your greenpeace account)
  2. Select the project “planet4-production”               
  3. Check the url of the file. The first part after the domain is the name of the storage bucket (in my example planet4-handbook-stateless ) 
  4. Filter by prefix for the name of the storage bucket 
  5. Browser to the correct folder (you can see it from the url)
  6. Find the file you want to replace. You can use the filter by prefix as in the next screenshot           
  7. Delete all images that start like that (both the original and the thumbnails that were automatically created). The thumbnails will be automatically recreated after you upload the image
  8. Upload the new file making sure it has the same name as the original old one (ignore the thumbnails for now)
  9. Change the permissions of the file so that it becomes public, by adding “User-Allusers-Reader” as the next screenshot.
  10. Check the permissions of an other file in the same folder, and make sure your new file has the same permissions.

Note about thumbnails:

Thumbnails are automatically created. Google in its documentation says that it may continue to serve the cached version for up to 1 hour. If during that time the cached image is picked up from the server and new thumbnails are created, there is a chance that the new thumbnails are created (again) from the old image. So, you may have to repeat the deletion of the thumbnails one hour later so that thumbnails get recreated from the new image.