Skip to content

Deploy a Wordpress Theme

This guide outlines how to deploy WordPress themes built with Vite, using our gulp-based workflow.


A deploy (sometimes referred to as a build) is the process of taking the work you’ve done locally and making it available in a shared environment, such as dev.

✅ DO❌ DON’T
Deploy only after finishing your taskDeploy while the feature is half-done
Test everything locally firstUse stage or production as a testing environment
Make sure your changes work as expectedAssume “it probably works”
Deploy only to dev (unless told otherwise)Deploy to staging or production without telling anyone
Ask your PM before your first deployDo your first deploy alone
Deploy when you’re ready for reviewDeploy just to “save your progress”
Communicate in Slack after deployingDeploy without telling anyone
Keep your deploys focused and cleanDeploy unrelated or experimental changes
Double-check forms, animations, and edge casesSkip QA because “it’s a small change”

To determine whether a project is using Vite or Webpack, check the root of the theme folder:

  • Vite projects will have a vite.config.js file.
  • Webpack projects will have files like webpack.common.js, webpack.dev.js, or webpack.prod.js.

Before doing anything else:

  • Open GitHub (or your Git client)
  • Review the files you’ve modified:
    • CSS / JS files
    • PHP files
  • Make sure everything is committed
  • Always pull the latest changes from the remote repository

For preventing some errors in the building process, make sure:

  • You are using the correct Node version (specified by project. Ask your PM about this):
nvm use 21
  • You installed the dependencies:
npm install

Inside the project, you’ll find a file called hash.php (or define-hash.php).

  • The hash is a unique string generated from your compiled CSS and JS
  • It helps browsers detect changes and avoid loading cached assets
  • Every time CSS or JS changes, a new hash must be generated
  • In the dist/js folder, you’ll see files like main.skf.js.

    • The skf part is the hash
    • This hash represents the latest compiled CSS and JS
  • To make a new hash, execute:

npm run build

Some projects use Webpack instead of Gulp, in that case the build command may be:

npm run dev
npm run stage
npm run production
  • This will make a new hash appear in main.7d2.js.
  • Copy-paste that hash into the hash.php file.

In your deploy.md or sftpConfig.js file you’ll find a cheatsheet of the commands you need to use, usually using gulp command.

Here are the main commands you can run:

CommandWhat it doesWhen to use it
gulp ddist --dev|stage|productionUploads all project filesRarely used. Only when you need to deploy the full project
gulp ddisthash --dev|stage|productionUploads only the /dist and /hash directoriesWhen you change CSS or JS files
gulp dfm --dev|stage|productionDeploys all flexible modulesWhen working with flexible or modular content
gulp dall --dev|stage|productionDeploys everything in the projectUse with caution. Only when explicitly needed
gulp dphp --dev|stage|productionDeploys only PHP filesWhen you change PHP logic or templates
gulp ds --dev|stage|production --path footer.phpDeploys a specific fileWhen only one file needs to be updated
gulp ds --dev|stage|production --path folder/Deploys a specific folderWhen changes are limited to a single folder

To prevent certain files from being uploaded, make sure they are listed in the filesToExclude constant inside sftpConfig.js.

Example:

const filesToExclude = [
"!functions/project/hash.php",
"!functions/project/local/local-variable.php",
"!public/**/*",
"!config/**/*",
"!node_modules/**/*",
"!src/**/*",
"!.env.production",
"!.env.virtual",
"!gulpfile.js",
"!package-lock.json",
"!package.json",
"!readme.md",
"!vite.config.js",
"!documentation/**/*",
];

This ensures that sensitive or non-deployable files are not accidentally pushed to the server.


  • Always confirm the project type (Vite vs. Webpack).
  • For Vite projects, use the gulp commands defined above.
  • Use ddisthash or dphp depending on what has changed.


Knowledge Check

Test your understanding of this section

Loading questions...