How to symlink your plugins

When building plugins, it’s a huge pain to drill into a site’s plugins folder and install a plugin, especially if it’s meant to live on multiple sites. The answer is to symlink a plugin folder! I’ll use my setup as an example.

  1. Download the repo (I put my repos at Documents/Github)
  2. Delete the existing folder from a site’s plugins folder (optional)
    • This won’t work if, say, CNO Lite Vimeo Block already exists
  3. Open Terminal and run the following command: ln -s "repo path" "plugins-folder-path"

Example: [CNHSA] CNO Content Federation Plugin

My plugin lives at Documents/Github/cnhsa-plugin-cno-content-federation and my site lives at Local Sites/cnhsa/app/public, so the full terminal command would be as follows:

ln -s "/Users/{$username}/Documents/Github/cnsa-plugin-cno-content-federation" "/Users/{$username}/Local Sites/app/public/wp-content/plugins"

# {$username} is a placeholder and should be replaced

If you look at your plugins folder in Finder, you should see a new “alias” or “shortcut” folder that, if you click into it, takes you back to wherever your git repo lives.

Note: Unfortunately, you can’t do this simply by right-clicking and selecting “Create Alias”.

Now, if you accidentally delete/overwrite your Local site or upload a built version of the plugin, you won’t mess up your git repo, you’ll just lose the link!

See something inaccurate?