Symlinked plugin being removed

What issue or error are you experiencing?

We’re using Local for developing a WordPress plugin. Developers clone our github repo and then create a symlink inside the WordPress plugin directory that points to those files. Two of our devs have noticed that these files get completely deleted frequently and apparently at random. For example, for one user this happened twice this morning. There doesn’t seem to be any consistency as to when this happens, we can simply be working on our files and then next minute they’re deleted ).

We are trying to track down the culprit, is there any possibility that there is something in Local that does this?

One thing that’s interesting is that our plugin has a build process which writes to the dist directory. When the wipe occurs, only the checked in files are removed, not the dist. For example:

// pre wipe
- .git/
- src/
- dist/
- readme.txt

In this case src and readme.txt are checked in. dist is ignored via .gitignore and is only created as a result of our build process ( e.g. yarn start ).

// post wipe
- dist/

In the above, even the .git directory is being removed.

We’d like to maintain the symlink for a couple of reasons:

  1. We have the plugin distributed to the WordPress plugin directory. If we accidentally click “update” it’ll blow away our local changes. Not hugely pressing, but can happen.
  2. We’re looking at moving to a monorepo, in which case it doesn’t make sense to clone directly to the plugins directory, and makes live development tricky.

Alternatively if you have other suggestions for local development workflow we’d love to hear them.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

It’s a little bit tricky because only two out of three devs see this happen, it doesn’t happen to everyone. But these are the steps we take:

  1. Clone a repo to your documents cd ~/Documents && git clone ...
  2. Create a symlink: cd ~/Local\ Sites/my-site/app/public/wp-content/plugins && ln -s ~/Documents/cloned-repo ./plugin-name
  3. Enable the plugin, do some work, etc
  4. Wait for it to break

System Details

  • Local Version:
  • Operating System (OS) and OS version:
    MacOS 14.3.1

Local Logs

local-lightning-verbose.log (222.6 KB)
local-lightning.log (30.2 KB)


For the three devs who are using this workflow are all of them on the same OS/OS version, Local version, and using the same network?

I’m assuming the logs provided are from the user who is having the issues?

The two facing the issue are on MacOS 14, I’m on 13 and I don’t see the issue. The two with the issue have been reporting it for a while though, I think that was before the update to 14, but I can’t be 100% certain. So I suppose maybe there’s something going on with Local + MacOS 14? I was actually going to update to 14 soon, so it’ll be interesting to see if the problem appears for me then.

We’re all on the same version of Local but we’re on different networks, we’re spread out remotely across the globe.

Yes the logs provided are from one of the users who is having the issue. Those logs were taken about 10 minutes after the issue happened last time.

Thanks for sharing this report and for the repro steps, @sandersweb.

I’ve been unable to repro so far with a symlinked plugin running a yarn dev process under macOS 14. I symlinked a plugin as you describe:

public/wp-content/plugins via 🐘 v8.1.23
> ls -alh
lrwxr-xr-x@ 1  staff    42B  5 Apr 09:02 my-plugin -> /Users/

Then I ran yarn dev, activated the plugin, clicked around, made plugin changes, stopped and started Local, stopped and started the site, left the dev process running for about an hour, and I can’t trigger folder removal — everything’s there including my original files and the built dist folder.

Many teams at WP Engine use Local to develop plugins this way (ACF is developed under Local using symlinks, for example) and we haven’t seen other reports so far. The only time Local actively deletes plugins that I’m aware of is during the creation of new sites, and even then it specifically deletes only the Akismet and Hello Dolly plugins to create a fresh install. It also deletes them in full (via WP-CLI) — it doesn’t do anything like selectively leaving dist folders in tact as you describe.

I wonder if something in your build process could be triggering file deletion? It’s common to scrub non-dist folders during plugin deployment, so perhaps you have a ‘clean’ or ‘build’ or ‘deploy’ script accidentally being triggered under certain conditions? You could double-check any ‘rm’ or ‘rimraf’ commands in your build scripts if you haven’t already to make sure they’re not overzealously deleting things (I would also check for any glob or negation patterns that use ‘dist’, since that’s the folder that survives unscathed).

You could also try building the plugin, cancelling your build process but leaving the plugin active in a running Local site to rule out Local as the cause. If files are only deleted when the build task is running then it’s probably the build task or some other external process.

If you get really stuck tracking it down feel free to DM me a zipped copy of the dev version of your plugin, assuming it’s not huge or the repo’s not already public (click my profile pic and choose “Message”). Happy to take a quick look in case anything stands out.


Thanks Nick

So from the sound of it, it doesn’t appear to be anything that could be coming from Local. We’ll continue to watch for it and will report back if we find anything to the contrary. We’ve got a little monitoring script set up which should hopefully let us know what’s removing things.

Thanks for your help!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.