WordPress + VS Code: Live PHP Debugging, IntelliSense & Dev Containers

Modern web development demands tools that streamline workflows, reduce repetitive tasks, and create more time for actual problem-solving. When working with WordPress—a PHP-based content management system—it becomes crucial to have efficient development tools. Visual Studio Code (VS Code), with its rich ecosystem of extensions and development container support, provides a powerful environment to enhance WordPress development. This article explores how to leverage VS Code to enable live PHP debugging, benefit from IntelliSense, and use Dev Containers to optimize your WordPress development experience.
Why Choose VS Code for WordPress Development?
Visual Studio Code stands out for its versatility, user-friendly interface, and extensive plugin support. When configured correctly, it can bring a professional-grade development experience to WordPress developers, traditionally relegated to more minimalist tools. Here are some compelling reasons:
- Lightweight yet powerful—VS Code loads quickly, even on large projects.
- Rich extension marketplace—Extensions for PHP, WordPress, Docker, and Git make VS Code a one-stop shop.
- Remote and container support—Work in isolated, reproducible environments using Dev Containers.
- Advanced debugging and IntelliSense—Write and debug PHP code more efficiently.
Configuring WordPress for Live PHP Debugging
Debugging in PHP traditionally involved using var_dump
, die
, or manually writing to logs. These techniques are not only slow but also unproductive. A proper debugging setup allows breakpoints, variable inspection, and step-through capability—all directly within VS Code.
Here’s how to set up live PHP debugging:
- Install Xdebug: This is the most popular PHP debugging extension. Most WordPress development environments like Local, MAMP, or Docker-based stacks support it. You need to ensure Xdebug is correctly configured in your
php.ini
file. - Install PHP Debug Extension in VS Code: This extension (by Felix Becker) enables VS Code to communicate with Xdebug.
- Configure launch.json File: In your VS Code project’s
.vscode
folder, create or editlaunch.json
for PHP debugging:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
Ensure your Xdebug is set to connect to port 9003 (default for Xdebug 3). With this setup, you can set breakpoints in your PHP code and inspect variables and function calls in real-time.

Using IntelliSense to Supercharge Productivity
IntelliSense in VS Code offers smart code completion, parameter hints, quick info, and member lists. For WordPress development, IntelliSense can be enhanced to provide context-aware suggestions for WordPress functions, classes, and hooks. Here’s how to improve IntelliSense support:
- Install PHP Intelephense Extension: This extension provides comprehensive PHP IntelliSense, supporting function definitions, error detection, and more.
- Add WordPress Source Code to Workspace: Adding the original WordPress source to your workspace helps the tool index definitions and references better.
- Enable WordPress Stubs: PHP Intelephense supports custom stubs. By adding WordPress stubs or downloading them from community repositories, you further improve IntelliSense accuracy.
Having smart suggestions directly in your code editor improves precision and significantly reduces the need to refer to documentation while coding specially complex WordPress logic, such as custom post types or WP_Query parameters.
Leveraging Dev Containers for Environment Consistency
One of the biggest pain points in modern web development is setting up and maintaining development environments. Dev Containers, a feature from Microsoft’s Remote Development extensions, allow you to package your development environment in a container, ensuring consistency across team members, CI pipelines, and production mirrors.
A Dev Container is defined by a .devcontainer
folder in your project root. Inside, you’ll typically find these files:
devcontainer.json
: Defines the container settings, extensions, and post-setup commands.Dockerfile or Docker Compose
: Declares the services and setup needed to run WordPress locally.
An example devcontainer.json
for WordPress might look like this:
{
"name": "WordPress Dev",
"dockerComposeFile": "docker-compose.yml",
"service": "wordpress",
"workspaceFolder": "/var/www/html",
"extensions": [
"felixfbecker.php-debug",
"bmewburn.vscode-intelephense-client"
],
"settings": {
"php.validate.enable": true
}
}
This setup allows developers to start coding immediately without needing to configure PHP, MySQL, or WordPress manually. You can fully isolate the WordPress environment, ensuring consistency between staging and local setups.

Bringing It All Together: A Productive Workflow
Imagine this: you clone a WordPress project repository that includes a .devcontainer
. You open it in VS Code, click ‘Reopen in Container,’ and within minutes, your entire environment is ready—WordPress installed, MySQL connected, debugging enabled, and IntelliSense in play. Here’s what that workflow would look like step-by-step:
- Clone the project repository containing Dockerized WordPress and Dev Container setup.
- Open the folder in VS Code and allow it to reopen in Dev Container.
- VS Code automatically installs required extensions and runs post-setup commands.
- Start coding with IntelliSense, and set breakpoints for live PHP debugging using Xdebug.
- Commit your Docker and VS Code configurations along with your code, enabling full reproducibility.
This method is especially beneficial for teams, remote contributors, and open-source projects where standardizing the development environment can drastically reduce onboarding time and setup errors.
Common Pitfalls and Troubleshooting
Despite the power of this setup, you may encounter a few bumps. Be aware of the following potential issues:
- Xdebug not triggering: Ensure your VS Code is listening on the correct port, and that
xdebug.mode=debug
andxdebug.start_with_request=yes
are set. - IntelliSense lag: This usually indicates a misconfigured path or large unindexed files. Use
intelephense.files.exclude
to skip unnecessary files. - Dev Container build issues: Use the terminal to examine logs, and make sure Docker is running correctly on your system. Also verify volumes and ports.
Final Thoughts
WordPress development often carries a reputation for being less structured, but with tools like VS Code, Xdebug, and Dev Containers, we now have the ability to bring enterprise-level consistency, debugging, and optimization to even the smallest projects. Live PHP debugging replaces outdated echo-based testing. IntelliSense reduces reference-checking and speeds up development. Containerized development environments prevent the “it-works-on-my-machine” headache.
By investing a bit of effort in setting up this toolchain, developers can unlock productivity gains that multiply over the long term. Whether you’re a freelance WordPress developer or working in a team, this modernized development approach is a logical step forward.
Start with one area—perhaps live PHP debugging—and gradually adopt IntelIliSense enhancements and Dev Containers. Soon, you’ll wonder how you ever shipped WordPress code without them.