Applies to: the WordPress Studio app, with a WordPress.com account. Previews are hosted on WordPress.com. The same file applies when you publish to WordPress.com or Pressable.
When WordPress Studio creates or updates a preview, it uploads the contents of your site’s wp-content directory. Use .deployignore to exclude files you don’t want in the preview, such as build artifacts, vendor dependencies, or large media folders.
Before you start
- A local site in WordPress Studio, and access to its site directory.
Add a .deployignore file
- In the root of your site directory, create a file named
.deployignore. - Add a pattern for each file or folder you want to leave out.
- Save the file.
- Create or update the preview.
Patterns are relative to the site root directory, not to wp-content. For example:
# Exclude vendor dependencies
wp-content/plugins/my-plugin/vendor
# Exclude all log files
*.log
# Exclude old uploads
wp-content/uploads/2024
# Exclude a specific plugin
wp-content/plugins/wordpress-seo
You can also use negation patterns to re-include specific items:
# Exclude vendor, but keep important-lib
wp-content/plugins/my-plugin/vendor/*
!wp-content/plugins/my-plugin/vendor/important-lib
What’s left out by default
Even without a .deployignore file, WordPress Studio leaves these out of a preview:
- The
.git,node_modules,.DS_Store, andThumbs.dbdirectories. - Themes that aren’t active, except the parent of the active theme, since they don’t change what the preview shows.
- The plugins that WordPress.com provides on every site.
Publishing a site to WordPress.com or Pressable uses the same .deployignore file, so the patterns you add also leave files out of a publish. See Publish.
Troubleshooting
Why is a file missing from my preview?
A pattern in .deployignore may match it, or WordPress Studio may leave it out by default. Check that your patterns are relative to the site root directory, not to wp-content. To keep a file inside an excluded folder, add a negation pattern that starts with !.
Why is my site too large to preview?
WordPress Studio can’t create or update a preview when the files it would upload are larger than 2 GB (gigabytes). Add the large folders, such as old uploads or vendor dependencies, to .deployignore, or remove media files, plugins, or themes you don’t need.