Contributing to WPGraphQL
Thank you for your interest in contributing to WPGraphQL! This guide covers how to contribute to any plugin in the monorepo.
Getting Started
- Fork the repository on GitHub
- Clone your fork locally:
git clone git@github.com:YOUR_USERNAME/wp-graphql.git cd wp-graphql - Set up the development environment (see Development Setup)
- Create a feature branch:
git checkout -b feat/your-feature-name
Development Workflow
1. PR Titles and Conventional Commits
PR titles must follow Conventional Commits format. This is important because:
- PRs are squash merged - your PR title becomes the commit message
- release-please reads these commits to determine version bumps
- Your PR title is validated by the
lint-pr.ymlworkflow
| Prefix | Description | Version Bump |
|---|---|---|
feat: |
New feature | Minor |
fix: |
Bug fix | Patch |
perf: |
Performance improvement | Patch |
docs: |
Documentation only | None |
refactor: |
Code change (no feature/fix) | None |
test: |
Adding/fixing tests | None |
chore: |
Maintenance tasks | None |
ci: |
CI/CD changes | None |
feat!: |
Breaking change (feature) | Major |
fix!: |
Breaking change (fix) | Major |
perf!: |
Breaking change (performance) | Major |
Breaking Change Marker (!): The ! suffix can only be used with feat, fix, or perf prefixes. Using ! with other prefixes (like chore!: or ci!:) will fail CI validation since those types don't trigger releases.
Examples:
feat: add support for custom post type archivesfix: resolve N+1 query issue in connectionsfeat!: change default behavior of user queriesperf: optimize resolver execution time
Note: Your individual commits within a PR don't need to follow this formatβonly the PR title matters.
2. Pull Request Templates
When creating a PR, select the appropriate template:
- π Bug Fixes - For fixing bugs
- β¨ Features - For new features
- π§ͺ Experiments - For experimental features
- π Documentation - For docs improvements
- π§ Refactoring - For code improvements
- π¦ Dependencies - For dependency updates
- π οΈ Maintenance - For CI/CD and tooling
3. Code Standards
PHP:
- Follow WordPress Coding Standards
- Run PHPCS:
composer -d plugins/wp-graphql check-cs - Run PHPStan:
composer -d plugins/wp-graphql analyse
JavaScript:
- Follow WordPress JavaScript standards
- Run linting:
npm run -w @wpgraphql/wp-graphql lint
4. Documentation
For new features:
- Add PHPDoc blocks with
@since x-release-please-versiontags - Update relevant documentation in
plugins/wp-graphql/docs/
For deprecations:
- Use
@deprecated x-release-please-versionin docblocks - Use
x-release-please-versionas placeholder in deprecation function calls
These placeholders are automatically replaced with the actual version by release-please during the release PR.
5. Testing
All changes should include tests:
# Run the full test suite npm run -w @wpgraphql/wp-graphql test:codecept:wpunit # Run specific tests npm run -w @wpgraphql/wp-graphql test:codecept:wpunit -- tests/wpunit/YourTest.php
See the Testing Guide for detailed instructions.
Automated Processes
Release Process (release-please)
We use release-please for automated releases:
- PR Merged: Your PR is squash merged with a conventional commit title
- Release PR Created: release-please creates/updates a Release PR with:
- Version bump based on commit types (
feat:β minor,fix:β patch,!β major) - Auto-generated changelog from commit messages
- Version bump based on commit types (
- Release PR Merged: When the Release PR is merged:
- GitHub Release is created
- Plugin is deployed to WordPress.org (the workflow uses
wp_org_slugfromrelease-please-config.jsonwhen the .org slug differs from the repo folder name) - Artifacts are attached to the release
Version Management
- Version numbers are updated automatically by release-please
@since x-release-please-versionplaceholders are replaced with the actual version during the release PR- Changelogs are generated from PR titles (via squash merge commits)
- Upgrade Notices are automatically added to
readme.txtwhen there are breaking changes
β οΈ Do not manually edit: Version numbers, changelogs, or upgrade notices. These are all managed automatically by release-please and our CI workflows.
When adding a new plugin that is deployed to WordPress.org, ensure its entry in release-please-config.json includes "wp_org_slug": "wpgraphql-*" if the WordPress.org directory slug differs from the repo folder name (e.g. wp-graphql-acf β wpgraphql-acf). See Architecture: Future Plugins and Workflows README.
Working with the Monorepo
Plugin Structure
Each plugin in plugins/ is a self-contained WordPress plugin:
plugins/wp-graphql/
βββ wp-graphql.php # Main plugin file
βββ src/ # PHP source
βββ tests/ # Test suites
βββ packages/ # JS packages
βββ composer.json # PHP dependencies
βββ package.json # JS dependencies
Running Commands
# Commands for specific plugins use workspace flag npm run -w @wpgraphql/wp-graphql <script> # Root-level commands npm run wp-env start npm run build # Builds all plugins
Adding Dependencies
# Add to a specific plugin npm install <package> -w @wpgraphql/wp-graphql # Add to root (shared tooling) npm install <package> -D
Types of Contributions
Bug Fixes
- Create an issue describing the bug (if one doesn't exist)
- Write a failing test that reproduces the bug
- Fix the bug
- Ensure the test passes
- Submit PR with
fix:prefix
New Features
- Open a discussion or issue first for significant features
- Implement the feature
- Add comprehensive tests
- Update documentation
- Submit PR with
feat:prefix
Documentation
- Documentation lives in
plugins/wp-graphql/docs/ - Use Markdown format
- Include code examples where helpful
- Submit PR with
docs:prefix
Experiments
Experiments are features being validated before core inclusion:
- See Experiments documentation
- Submit PR with
feat:prefix andexperimentlabel
Code Review Process
- All PRs require review from a maintainer
- CI checks must pass (tests, linting, code quality)
- Address review feedback
- Once approved, maintainer will merge
Getting Help
- Discord: wpgraphql.com/discord
- Discussions: GitHub Discussions
- Issues: GitHub Issues
License
By contributing to WPGraphQL, you agree that your contributions will be licensed under the GPL v3 license.