@see https://make.wordpress.org/core/handbook/tutorials/trac/submitting-a-patch/
make a new trac ticket (like https://core.trac.wordpress.org/ticket/62407)
-
make a fork of https://github.com/WordPress/wordpress-develop in your github account
-
clone fork locally
-
add wordpress-develop as second remote :
git remote add fork [email protected]:WordPress/wordpress-develop.git
-
update local clone :
git fetch --all
-
create a new branch :
git checkout -b fix/{track-ticket-nr}
-
follow setup instructions here https://github.com/WordPress/wordpress-develop?tab=readme-ov-file#development-environment-commands :
npm install npm run build:dev npm run env:start npm run env:install
-
copy
.env.example
into.env
and enable line:LOCAL_PHP_XDEBUG=true
-
add a
./vscode/launch.json
:{ "version": "0.2.0", "configurations": [ { "name": "wp-env", "type": "php", "request": "launch", "port": 9003, "stopOnEntry": false, // set to true for debugging this launch configuration "log": false, // set to true to get extensive xdebug logs "pathMappings": { "/var/www": "${workspaceRoot}", } } ] }
-
append the following lines to
./tools/local-env/php-config.ini
and./tools/local-env/phpunit-config.ini
xdebug.mode=develop,debug xdebug.start_with_request=yes
-
restart development environment :
npm run env:restart
-
set breakpoint in tests and debug tests :
npm run test:php
-
you can even run only selected tests. example usage :
npm run test:php -- --filter Tests_Block_Template
-
CAVEAT : not the whole test suite will run successfully when xdebug ist enabled
-
-
fix the code and commit it
-
create a pull request and enter trac ticket url and short description that the pull request does