Shared media files
Media files that are uploaded to a WordPress production environment are automatically available to its associated non-production environments.
When a data sync from a production environment to a non-production environment is completed, the target environment will automatically load the shared media files that were uploaded to production. This eliminates the need to copy media between environments as long as the development workflow follows code moving up, and content moving down.
A media file can load at a URL that has either environment’s domain as long as it has the same file path beginning with /wp-content/uploads/
.
As an example, if a file is uploaded to an application’s production environment and available at this URL:https://example.go-vip.net/wp-content/uploads/2022/12/image.jpg
The application’s non-production environment will also have access to that image at this URL: https://example-preprod.go-vip.net/wp-content/uploads/2022/12/image.jpg
Other default behaviors:
- Shared media files have the same caching rules applied to them on all of an application’s environments.
- Shared media files are in read-only mode when accessed from non-production environments, protecting them from being altered unintentionally.
- If a non-production environment uploads a file of the same name and the same path as the file shared by production, it will only override the file shown on the non-production environment (the original file uploaded to production remains intact).
Limitations
- Files can only be shared from a production environment to its associated non-production environments. Files uploaded to a non-production environment cannot be shared with the production environment.
- The non-production environment cannot delete a file that was originally uploaded to the production site. The operation will not error, but the production file will not be affected and continue to be available.
- If a file uploaded to production is deleted from production, it will no longer be available to be shared with the non-production environments.
Last updated: March 07, 2023