WordPress Development Repository Overview
Welcome to the WordPress development repository! If you're looking to contribute, report bugs, write documentation, or get involved in any other way, please refer to the contributor handbook for detailed guidance.
Getting Started with Development
To begin, create a codespace for this repository by clicking the "Open in GitHub Codespaces" button. This will open a fully configured development environment in a web-based version of Visual Studio Code. The dev container is equipped with all the necessary software for the project.
Note: Dev containers follow an open specification supported by GitHub Codespaces and other development tools. Depending on your browser, the keyboard shortcut to open the command palette (Ctrl/Command + Shift + P) may conflict with a browser shortcut. Alternatively, you can open the command palette with the F1 key or via the cog icon in the bottom left of the editor.
When setting up your codespace, ensure that the postCreateCommand
finishes running before proceeding. This may take a few minutes and ensures that your WordPress installation is correctly configured.
Local Development Setup
WordPress is a project built using PHP, MySQL, and JavaScript, with Node.js used for JavaScript dependencies. A local development environment can be quickly set up for testing and development purposes.
To proceed, you’ll need a basic understanding of command-line usage on your computer. This will help you set up, start, and stop the local development environment, as well as run tests.
Requirements:
Node.js and npm:
Node.js is a JavaScript runtime that facilitates developer tooling, while npm is the included package manager. Installation can be simplified using a package manager for your OS:
macOS: brew install node
Windows: choco install nodejs
Ubuntu: apt install nodejs npm
Alternatively, you can download installers and binaries from the Node.js download page.
Note: WordPress currently supports only Node.js 14.x
and npm 6.x.
Docker:
Docker is essential for powering the local development environment. You can install Docker just like any other application.
Development Environment Commands
Before running the commands below, ensure Docker is running on your machine.
Starting the Development Environment (First Time Setup):
Watching for Changes:
- If you’re making changes to WordPress core files, start the file watcher to automatically build or copy files as needed:
npm run dev
- To stop the watcher, press
Ctrl + C
.
Running WP-CLI Commands:
- Use the following syntax to run WP-CLI commands:
npm run env:cli -- <command>
- Example:
npm run env:cli -- help
Running Tests:
- PHP tests:
npm run test:php
- End-to-end tests:
npm run test:e2e
Restarting the Environment:
- If you’ve made changes to configuration files like
docker-compose.yml
or .env
, restart the environment:
npm run env:restart
Stopping the Development Environment:
- To conserve your computer’s resources, stop the environment when not in use:
npm run env:stop
Starting the Development Environment Again:
- To restart the environment, use:
npm run env:start
Default Credentials
Here are the default credentials for the development environment:
- Database Name:
wordpress_develop
- Username:
root
- Password:
password
To log in to your WordPress site, go to http://localhost:8889/wp-admin
and use:
- Username:
admin
- Password:
password
If you're using GitHub Codespaces, open the port-forwarded URL from the ports tab in the terminal and append /wp-admin
to log in.
Important: It’s recommended to generate a new password after logging in:
- Go to the Dashboard.
- Click on the Users menu on the left.
- Click the Edit link below the admin user.
- Scroll down and click Generate password. Use this password (recommended) or change it, then click Update User. If using the generated password, be sure to store it securely (e.g., in a password manager).