In one of the slack channels I follow, the question came up on how to set WordPress posts older than a certain date to “draft” status using with WP CLI. I was surprised by how difficult I found this task and wanted to document my solution.
You can tell composer to install dependencies as if you’re using a specific version of PHP. This can be helpful if you’re running composer outside of your virtual machine (and your virtual machine has the correct PHP version but your host machine does not).
The editorconfig project allows you to standardize general coding standards on a project.
I was working on a project where I needed to follow the PHP PSR-2 standard. This is the .editorconfig file I used.
When working with Git on the command line, I spend a lot of time switching back and forth between two branches. Even with Git tab completion, it is a lot of typing. However Git has a shortcut for the previous branch, a single dash (-).
I was working on one Git branch and I wanted a file from another branch. Using git checkout, we can do this.
A quick table of the differences in 301, 302, 303, and 307 Redirects.
I’ve written about using “git push –force-with-lease” instead of git push –force” because “force-with-lease” will only force push changes if your local copy is aware of all of the commits on the remote branch but how is git “aware” of the commits.
On a project I needed to redirect a URL based on the presence or absence of a URL parameter. This is the htaccess rule I added.
Never use git push –force. Seriously, don’t use it. You should always use –force-with-lease instead. We’ll look at the problem with –force and how –force-with-lease addresses the issue.