Windows,  WordPress

Symbolic links – test your themes and plugins

Symbolic links are great feature in Linux/Unix. Mac has this feature even in its GUI. Many of you knows that Windows can handle symbolic links too. But there are some people that doesn’t know about this feature or doesn’t care because they didn’t think about its power.

Of course I’m not gonna to write about symbolic links just for symbolic links. We will use it in real life, for our projects. First of all, I will share one of my computers configuration with you.

My first hard drive is 960GB SSD. I use it for my operating system (Windows 7 Pro), programs and local server. Server is stored in C:\server\. There are folders with Apache files, MariaDB files, PHP files etc. And there are C:\server\sites\ folder with my local sites. Now let’s assume I want to write My Plugin and My Template for WordPress. I need to test it somewhere.


I create C:\server\sites\my-test\ and install WordPress in there. I setup my VirtualHost so I can access this WordPress via http://my-test.local

It works great. What do I need to create my plugin and theme? Of course I must create two additional directories: C:\server\sites\my-test\wp-content\plugins\my-plugin\ and C:\server\sites\my-test\wp-content\themes\my-theme\. And now I’m ready to develop. Or am I?

Well, actually yes, I am ready. But what if I want to use some repositories to make my work faster, cleaner and much more documented? I use a lot of GIT/SVN repositories, depending on what I’m doing. Let’s assume this will be GNU/GPLv2 work and I will use Github to store my new plugin and theme.

It’s pretty easy, go to github.com, create repositories and… well, now we have a problem. I use different folder for repositories. For github.com it would be C:\repos\github.com\. I can’t (in easy way) create repository in C:\server\sites\my-test\wp-content\… folders because all of that /trunk, /branches, /.svn folder etc. So, now I got my plugin in: C:\repos\github.com\my-plugin\trunk\ – and my WordPress installation can’t reach this.


Now it’s time for symbolic links!

It’s pretty easy. Go to your Start menu and run command prompt. Sometimes running command as an administrator may be required. Then write something like this:

C:\>mklink /D "C:\server\sites\my-test\wp-content\plugins\my-plugin\" "C:\repos\github.com\my-plugin\trunk\"
C:\>mklink /D "C:\server\sites\my-test\wp-content\themes\my-theme\" "C:\repos\github.com\my-theme\trunk\"


And that’s it! /D switch is obviously for directories (folders), second parameter is our target and third parameter (maybe it isn’t very intuitive) is our physical directory. Go and write your new plugin or template!

Leave a Reply

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