DEV Community

tranminhdz
tranminhdz

Posted on

Wordpress workflow in 2019

Hi,

I am new to Wordpress and I study Wordpress through Udemy course and read some articles which are not up to date.

Currently I am using

  • No git
  • Local by flywheel to create WP project locally
  • All in one wp migration to deploy (it will override all things)
  • WP Migrate db to update database
  • Ftp or Wordpress file manager plugin to update WP content

However, I realize that this stack is quite old and I have to do lots of work manually. I want to ask you guys about wordpress workflow in 2019

Workflow

1. Git:
I am familiar with git but I am not sure how to use it in WP.

  • Should I init git in root of project and use WP gitignore or I init git in wp-content directory?
  • Should I ignore plugins

I try to init git in root of project and add gitignore but there are many weird files are tracked by the git and I am not sure if I should ignore them

2. Webpack
I am familiar with Webpack since I worked with React. I can easily set up Webpack and Babel to bundle my projects (I set up it in the custom theme). However I am not sure how to optimize WP images. I can see WP has many plugins, wp-smushit, for that, should I use them or there is a better option. Should I use webpack instead of gulf since I can see that there are many gulp tutorial?

3. Upload WP content to staging and production
Currently I use Ftp for that but I know it is the old way. I have to remember which files have been changed then upload them. How can I upload these changed files automatically (when I merge to dev branch for staging and master branch for prodction)? Does it depend on host service because I can see the price is extremely expensive to have that (WPengine ,...)

4. Push local database to staging and production database
Since the production database changes constantly (I intend to build Woocommerce web), I cannot use WP migrate pro or All in one migration because it will override the whole db.

Currently, after uploading the wp-content to staging and production, I have to go to production and add page, advanced custom field manually. I can see Advaned custom field has export/import tool, should I use that to push new advaned custom field to production?

If I add a page locally, or add a Advanced custom field. How I push it to production and staging?

5. Sync productionDB, stagingDB with local
In order to keep my local to sync with production, I use WP migrate pro for that because it is no harm to override local DB

6. What is the difference between wp-sync-db and wp-migrate-pro?
Thank you guys very much. Could you suggest your development workflow?

Top comments (3)

Collapse
 
matthewbdaly profile image
Matthew Daly

Have a look at Bedrock. It reorganises Wordpress to be more secure, uses Composer for handling plugins, themes and the Wordpress core, and moves configuration to a .env file.

The same people also make Sage, a boilerplate for theme creation that uses Webpack and Laravel Blade.

Collapse
 
zorca profile image
Zorca Orcinus • Edited
  1. Init git in PROJECT directory (see github.com/roots/bedrock)
  2. Use Webpack for optimizing theme images only
  3. Use Deployer and WP-CLI for all your deployment needs
  4. Use WP-CLI for DB deployment
  5. Don't use plugins
  6. Don't use plugins )))
Collapse
 
thisisthien profile image
Thien Nguyen • Edited
  1. Use Git in your working projects only.
  2. Webpack is ok. You can use any bundler tool that is familiar to you. (I'm using Gulp for WordPress)
  3. How about CI/CD?
  4. Why do you need to keep the database consistency between your local and staging/production?