Setting up WordPress development on your local machine is not as simple as downloading a zip file and uploading it to the server. You will need to set up an environment that is similar to what you would find on the production server in order for your code changes to be accepted by the core team.
There are many different ways that you can set up a development environment, but this tutorial will teach you how to set up WordPress locally using VVV and Local by Flywheel.
VVV (Varying Vagrants Vagrant) is an open-source local development environment focused on WordPress, powered by Vagrant. VVV is ideal for developing themes and plugins as well as for contributing to WordPress core.
Please follow the instructions and install VVV on your development machine.
The default configuration for VVV includes WordPress trunk, if it’s not you can use the following configurations in the config.yml file
sites:
wordpress-trunk:
description: "An svn based WP Core trunk dev setup, useful for contributor days, Trac tickets, patches"
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop.git
hosts:
- trunk.wordpress.test
Once the configuration has been added run the command vagrant provision
It was created to provide an easy way for developers to work on their projects offline, without the need to use any other tools or frameworks.
The main features of Local by Flywheel are:
– A free local development environment
– Provides an easy way for developers to work on their projects offline
– No need for any other tools or frameworks
You can follow the instructions for creating a WordPress trunk in Local
cd Local Sites/wptrunk/app
copy wp-config.php file to app directory
cp public/wp-config.php ./
rm -rf ./public
git clone https://github.com/WordPress/wordpress-develop/ public
mv wp-config.php ./public/
cd public
npm install && grunt build
All of the following commands are run over SSH (i.e. within the website).
/build
directory. To configure our site update both the siteurl
and the home
options in the database table (wp_options
) by appending /build
to them.
wp option update siteurl "$(wp option get siteurl)/build";wp option update home
You can learn more about setting up PHP unit tests in reference articles
References :