Cloned site + re-add as NEW Child: will Code Snippets detect snippets already saved on the child?

We used MainWP Code Snippets with snippets type “Execute on Child site > Save and Execute Snippet”

After that, We cloned/migrated that WordPress site to a new domain.

The MainWP Child plugin is installed and active on the new site. But we reconnected it so the MainWP Dashboard detects it as a new child site.

Since the snippets were saved on the original site (DB option) and the DB was cloned, the codesnippets are still present on the new domain, is it?

Question:

When adding the cloned site as a new child, will the Code Snippets extension detect snippets already saved on that child and show them as “applied” in the Dashboard?

If not, is there any supported way to list/pull existing saved snippets (saved previusly with the Mainwp Code Snippet Addon)?

Thanks

Hey @suki

If a cloned/migrated site is added as a new child, MainWP Code Snippets won’t automatically detect previously saved snippets on that site and mark them as “applied.”

The code can still exist on the cloned site (because the DB was copied), but the Dashboard treats it as a new child entry.
To have it shown/applied in the Dashboard, reselect that new child in the snippet and run/save it again.

Thank you for responding.

In this specific case, the site was cloned some time ago. Since then, snippets have been added, modified, and removed from both the original and the clone.

Now we don’t really know which snippets were cloned from the original… and are still hidden there.

Is there any way to know or see which snippets were duplicated and are still there “hidden”?

Snippets of type “Save to wp-config.php” are written directly into wp-config.php, so check that file for them.

Other snippet types are stored in the WordPress options table wp_options under the option name mainwp_ext_code_snippets.

To reset snippets on a specific child site, clear or delete that option mainwp_ext_code_snippets.

As always, please make a DB backup before making any changes to it.

Thank you, I will do that.

In any case, it seems that the CodeSnippets add-on needs improvement in this regard…

I’ve seen See which Code Snippets apply to a Child Site at a glance - MainWP to improve from the Main Site, but perhaps the Child Site plugin or a separate plugin (such as Key Maker for Bulk Setting) would be needed to manage this on the Child Sites…