Code snippets lost

I’ve been using the code snippets plugin to run some snippets on child sites. Up until today MainWP always knew which sites had the snippets installed on (yet still runs a check before adding the snippet to new sites). Now, the list was blank after loading the snippet. This “break” happened after I tried to run the snippet on some sites using a tag. I selected the tag, the snippets were installed… but now I have no idea which sites have them. Anytime tags (site tags) are used things break… I’ve tested this again.

This is really frustrating as I don’t know which sites now have the snippets running on them!

If I run the snippets again, will they be added twice to a site?

Hi @xyzulu

I tried to reproduce this issue, but I couldn’t. These are the steps I took:

  1. Loaded a snippet A and executed it on a single child site
  2. Loaded a snippet B and executed on a Tag
  3. Loaded snippet A again, and the child site was properly selected in the sidebar
  4. Loaded snippet B again, and the Tag was properly selected in the sidebar

Keep in mind that after you load a snippet, if you swap between Sites and Tags in the sidebar, the selection will be cleared.

Are you using the latest versions of Code Snippets (4.0.3), MainWP Dashboard (4.5.0.1), and Child Plugin (4.5)?

I am using the latest versions…

As I recall this is what happened:

  1. I loaded the snippets (previously applied sites were ticked)
  2. I selected a tag and saved the snippet. Everything happened as it usually did
  3. I reloaded the snippet the next day, no sites were selected

I was only using one snippet in my example, so perhaps try to test with that? Also, I had to come up with a solution so I ran the snippet on all sites for now. The question I still have is: Will snippets get added multiple times to each site? Or just once?

Thanks for the update.

There is indeed a visual problem when using the same snippet across a selection of child sites and a selection of tags.

For example, if you:

  1. Load a snippet and execute it on a selection of sites
  2. Load the same snippet and execute it on a selection of tags
  3. Load the same snippet again, only the tags will be selected in the sidebar

And if you were to switch between the Sites and Tags in the sidebar, the selection for both will be cleared.

I’ve passed this along to the development team.

However, the snippet will not be added multiple times.
So if you were to execute a snippet for a child site and then for a Tag that includes that child site, the snippet will be added to the DB only once.

Ok, I think we can put this down to a UI bug… as you noted. I have reapplied the code snippets to all my sites and everything looks ok now.
Thanks for looking at this…

PS some of your code snippets on GitHub are still in the wrong repositories, see:

1 Like

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