Using Junctions for multi-environment WordPress development

Alt text: Editorial-style illustration of a Windows 11 development workbench where a central ‘plugin code’ crate (D:\GitHub\wp-rename-divi-projects) connects via ‘JUNCTION’ pipes to two WordPress site boxes labelled ‘Divi 4’ and ‘Divi 5 beta’, with callouts ‘Single source of truth’ and ‘no copying’ and a Visual Studio Code window above.
One plugin code directory being pulled into two WordPress environements for testing

If you’ve been building for the Divi ecosystem lately, you know the challenge. We are currently in a ‘dual-world’ phase. We have Divi 4, the reliable workhorse, and Divi 5, the lightning-fast, Gutenberg-compatible future currently in beta.

When I was updating my plugin, WP Rename Divi Projects – which lets users rebrand Divi’s ‘Projects’ custom post type into something more semantic like ‘Books’ or ‘Properties’ – I hit a challenge. I needed to ensure the code worked perfectly on both versions of Divi without constantly switching Git branches or, worse, manually copying files back and forth.

I wanted:

  • One ‘single source of truth’ directory with my plugin code
  • One Visual Studio Code window
  • Two live WordPress sites

Here is how I set up a seamless Windows 11 development environment using a hidden gem of the filesystem: Junctions.

The development stack

The architectural problem

Normally, if you have two sites in WordPress Studio (one for Divi 4 and one for Divi 5), they exist in separate folders on your C: drive. So, if you want to test your plugin on both, you usually have to maintain two copies of the code.

That’s a recipe for disaster! You fix a bug in the Divi 4 site, forget to copy it to the Divi 5 site, and suddenly you’re debugging old code.

The solution: directory Junctions

I kept my actual development code in D:\GitHub\wp-rename-divi-projects. To make WordPress think the plugin was actually inside its own /wp-content/plugins/ folder, I used a Junction.

A Junction is like a shortcut on steroids. To the Windows API and WordPress, the junction is the folder. It doesn’t just point there; it acts as if the files are physically present in both locations.

Step 1: Setup

  1. Open Command Prompt as an Administrator (this is crucial for mklink).
  2. Navigate to your WordPress Studio plugin folders.
  3. Run the following commands (adjusting for your actual usernames/paths):

For the Divi 4 site:

For the Divi 5 Beta site:

Step 2: Workflow

Once the junctions are created, the magic happens:

  1. Activate the plugin in both WordPress dashboards.
  2. Open the D: drive folder in Visual Studio Code. (I created a workspace with only the GitHub folder with my plugin code.)
  3. Code using Visual Studio Code and the Codex AI (GPT 5.3) extension. Because there is only one source of truth, the AI indexing is flawless—no duplicate file confusion.
  4. Save once. Refresh both sites. The changes are instant on both versions of Divi.

Why this beats branching

While Git branches are great for features, they are annoying for simultaneous environment testing. With this setup:

  • Zero file copying: You never hit Ctrl+C and Ctrl+V between folders.
  • Real-time feedback: You can see how a PHP 8.x function or a specific Divi 5 hook behaves immediately after typing it.
  • Clean Version Control: Your Git history stays tidy because you aren’t fighting with local path differences.

The result

This setup transformed a potentially messy upgrade process into a streamlined, professional workflow. If you are a developer on Windows juggling multiple PHP versions, CMS versions, or in this case, the massive leap from Divi 4 to 5, stop copying files. Start using junctions.

It’s stable, it’s fast, and it’s exactly how a modern Windows dev environment should feel.


How to safely remove a Junction

When you have finished testing your plugin against both Divi 4 and Divi 5 and you want to ‘unplug’ the connection without touching your actual code on the D: drive, follow these steps:

The safe Command Line method

Open your Command Prompt (you don’t usually need Admin just to delete a junction you created, but it doesn’t hurt) and use the rmdir command.

Even though it looks like a folder, Windows treats the junction as a directory link, so we ‘remove the directory’ link like this:

Why this is safe

  • rmdir on a junction only deletes the link.
  • It does not touch the files in D:\GitHub\wp-rename-divi-projects.
  • Your Git repository remains perfectly intact.

How to tell it’s a Junction in File Explorer

If you are ever unsure whether a folder is a real folder or a junction, look for the small curved shortcut arrow on the folder icon in Windows File Explorer.

Windows 11 folder with a small arrow in the bottom left corner to indicate it is a Junction.

In the “Type” column of File Explorer, it may still say File folder, but if you run the dir
command in the parent directory via Command Prompt, you will see <JUNCTION> listed next to the name instead of <DIR>.

Final thoughts

By using Junctions, you aren’t just working harder; you’re working according to the DRY (Don’t Repeat Yourself) principle – not just in your code, but in your entire filesystem architecture.

It allows you to stay focused on one set of files, keeps your Git history clean, and lets you toggle between Divi 4 and Divi 5 environments as fast as you can hit refresh.

Published by

Gareth Saunders

I’m Gareth J M Saunders, 54 years old, 6′ 4″, father of three (including twins). Enneagram type FOUR and introvert (INFJ), I am a non-stipendiary priest in the Scottish Episcopal Church, I sing with the NYCGB alumni choir, play guitar, play mahjong, write, draw and laugh… Former Scrum master at Safeguard Global, Sky and Vision/Cegedim. Former web architect and agile project manager at the University of St Andrews and previously warden at Agnes Blackadder Hall.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.