Tested Snippet is breaking my sites

Hi,

I have a code snippet that I have developed using the Code Snippets plugin. The sites that I have installed it on with that plugin work fine. The “snippet” is 285 lines of code.

However when I try to use MainWP to push this snippet to my managed sites, whichever site I do that breaks. I have to login with Recovery Mode, and deactivate the MainWP Child plugin which is throwing an error. Even after I delete the plugin, if I try to reinstall it, it throws the error again and cannot be activated.
The error message is:

Parse error : syntax error, unexpected ‘s’ (T_STRING), expecting ‘)’ in /home/thehivea/public_html/wp-content/plugins/mainwp-child/class/class-mainwp-utility.php(87) : eval()'d code on line 14

Now the 3 sites I have tried this snippet on cannot be reconnected to MainWP manager. Any advice?

Hey @ushan_mrwebsites

The code snippet needs to be removed from the Database before the Child plugin can be reactivated. You can find more information on how to do so in our help document.

When an error message includes eval(), it strongly indicates that there’s a problem with the actual code of the snippet. Can you please double-check and see if you can find any errors?

In our testing, we didn’t find any issues with Code Snippets on MainWP Dashboard v4.3.
If possible, can you try testing it on a site (that you don’t mind going down temporarily if there’s something wrong with the snippet) connected to Dashboard 4.2.7.1, and see if you encounter the same issue?

And as always, it’s a good idea to try complex snippets on just one test site to avoid situations such as these.

1 Like

Thanks Bojan,

I found the snippet in the db. I’ll be more careful in future.

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