How to update WordPress for Vagrant usage
This is a common use case when you are running locally a different version of WordPress than the one on your production site. In this case, you need to update the WordPress version accordingly.
In order to upgrade WordPress for Vagrant, you need to go to the /wordpress folder from the repo, where WordPress should be cloned to. Then simply checkout the latest WP release commit, commit this change to the repo and you’ll have that version from that moment on. That should normally be much faster and less prone to errors than the upgrade through wp-admin. Here are the detailed steps:
Step 1: Run a git pull to have the latest changes
From your terminal window, go to the /wordpress folder of the repo you want to have WordPress updated. WordPress should already be cloned inside the repository.
You run a Git pull, in order to fetch all the changes from the WordPress repository. Most probably you’ll see new branches and various commits.
Step 2: Find the latest WP release commit
Go to the public GitHub repository of WordPress and select the corresponding branch of the version you want to update to, in this example I selected the 5.2 branch:
Click on the commits list to see all the commits made on this branch.
Look for the version you’re looking for and click on it (in our case it’s WordPress 5.2.2):
This will take you here:
The last part of the URL is the actual commit hash, which is where we want to point (
Step 3: Checkout the latest WP release commit
Go back to your local /wordpress folder and run:
git checkout 3fe25878ba30d289f1476be70399f78f056416fe
You will get a message similar with this:
Note: checking out '3fe25878ba30d289f1476be70399f78f056416fe'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 3fe25878ba WordPress 5.2.2. Built from https://develop.svn.wordpress.org/branches/5.2@45547
Step 6: Push the changes
Go to the upper folder and add, then push the changes:
cd .. git add wordpress git commit -m "Update WordPress to v 5.2.2" git push
After that, the changes will remain in the repo and whenever you clone it again, it will be with WordPress version 5.2.2