Reliably show where code snippet is already present

Apologies for potentially missing an obvious setting, but I’m still completely in the dark about how to see where a saved code snippet is already present from within the MainWP dashboard.

Here’s what I’m doing:

  • I’ve created a snippet to customise the WP login
  • added it to only a few sites and it works fine
  • added it to a couple of more sites. All fine.
  • I now want to see which sites I have added the snippet to (i.e. to remove it again from some)
  • The check boxes alone don’t help, because they only ever show me the last bunch of site I’ve added the snippet to
  • I’d simply like to see which sites currently run the code snippet, and which ones don’t
  • It would also be helpful to then see an option to remove it again, basically better UX and clarity.

Sorry if I’m being dumb here. I’ve checked the info at Add Code to WordPress for MainWP Website Management and it’s just incredibly vague. I also re-read a response to a previous ticket, which wasn’t quite clear either. The select/deselect of checkboxes for this purpose does not reflect the status quo of where the snippet is currently installed. In essence, it just does not seem straightforward enough and doesn’t give the type of prompts and confirmations that are visible in other areas of the WPmain Dashboard.

Hi Nadja,

When you load your snippet from the list of saved code snippets:

All selected sites in the Select Sites list represent sites where the snippet is saved:
image

1 Like

So sorry, but that’s simply not the case for me.
I select the saved snippet I want to check on and it’s only showing a check against a single site - the one where I LAST installed it. But it’s positively present on quite a few other sites which are not ticked.

Hi Nadja,

Can you please tell me what is the snippet type you use?

It’s a function that customises the WP login page.

I meant, do you have it set as set as Execute on Child Sites type?

image

Yes, that’s what it’s set to by default. Is that the mistake? The other two options made less sense to me since I would normally save this snippet to the theme’s functions.php manually (I asked about this in a previous post) and was hoping to be able to use MainWP code snippets to achieve this.

Hi Nadja,

You have the correct snippet type selected. So that is not causing the problem on your side.

Here is a demo video I made so you can see how it works on my side:

No, sadly that’s all messed up on my side.
Also, I’m not quite clear: After installing them all and you were unselect a couple and run it again, it would uninstall it from those unselected, right? So the tick says, it’s present on these sites.
So if I deselect all and select two different sites and run it, it removes it from the unselected and adds it to the newly selected etc.?
I have the feeling I will have to manually start again and go through the individual sites. Might well have been my cockup somewhere. I’ll check it out again. Thanks for your help!!

Yes, that sounds right.

If you apply a snippet on all sites, and in the next visit, you uncheck some sites, the extension will loop through all sites and remove the snippet from the sites you unchecked. Later, for example, you uncheck other sites and check some new sites, the extension will loop through all sites again, remove the snippet from unchecked sites and apply it to the newly selected sites.

This request is quite relevant for this issue. Posting it here to get more attention for it.

@nadworks You can upvote it to increase the priority for the dev team.
@bogdan The request is closed for new replies. Is that correct as it’s a feature request?

2 Likes

@josklever, I am not sure how that request got closed, but I reopened it.

1 Like

I think I’m getting the hand of it. Thanks.
What if I have to make a change to the code and re-execute it? Will it do what I expect and overwrite the old code at the targeted sites?

Yes, if you load the applied snippet and edit code, the extension won’t add it as new snippet and run the old and the new one, it’s going to update the one that was already applied.

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