• Resolved rosiearnfield

    (@rosiearnfield)


    Hi,

    I added a new code snippet and it broke my website with a 500 internal server error.

    Bluehost restored my website by uninstalling the plugin.

    But even after deleting Code Snippets plugin and deleting all of the data, when I reinstall the plugin it completely crashes the site including the admin system.

    What can I do? Error details below.

    WordPress version 5.3.1
    Current theme: Preschool and Kindergarten Pro (version 2.2.7)
    Current plugin: Code Snippets (version 2.13.3)
    PHP version 7.3.12
    Error Details
    =============
    An error of type E_COMPILE_ERROR was caused in line 9 of the file /home4/zlgqfqmy/public_html/astartuitiononline/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(213) : eval()’d code. Error message: Cannot redeclare wc_billing_field_strings() (previously declared in /home4/zlgqfqmy/public_html/astartuitiononline/wp-content/plugins/code-snippets/php/snippet-ops.php(361) : eval()’d code:1)

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Cannot redeclare wc_billing_field_strings()

    This is the main problem with Code Snippet!
    It allows to save Code Snippet even if the same function exists somewhere. Checking if function exits or not is totally unreliable. You must yourself check that you don’t redeclare any stand alone function (inside classes there can be functions, which has the same name).

    The only way to fix this issue is to use phpMyadmin and inactivate/delete the snippet, which cause this issue.

    Thread Starter rosiearnfield

    (@rosiearnfield)

    Where would I find the snippet in phpMyadmin if I have deleted the plugin and all of the data?

    When I reinstall the code snippet plugin it still crashes the site. How do I resolve it so that I can reinstall the plugin?

    Thanks in advance.

    If you have no touched to the database, the database has table for code snippets. Reinstalling doesn’t help, because it does not change the database.

    If you have not defined prefix for tables, the default name is wp_snippets. Find the field “active”.

    I have explained in some topics, which are main problems. Here one:
    https://wordpress.org/support/topic/problem-with-deactivate-and-activate-a-snippet/

    The snippet should be in wp_snippets – The offending snippet/s can be deactivated with a value of 0.

    https://wordpress.org/support/topic/help-i-just-activated-a-snippet-and-my-site-broke/

    The easiest way if the plugin is active and you are still logged in is to use this url format.

    https://example.com/wp-admin/admin.php?page=snippets&snippets-safe-mode=true

    Or if you cannot login add: define('CODE_SNIPPETS_SAFE_MODE', true); to wp-config.php

    which should allow you to login.

    • This reply was modified 4 years, 7 months ago by keniry.
    Plugin Author Shea Bunge

    (@bungeshea)

    The above advice is great, in particular the most recent post from @keniry.

    Please let me know if you’re still having issues after following it, @rosiearnfield.

    I have entered an incorrect code on my snippet plugin and Im trying to edit the code but when I activate the plugin it crashes my website and I can’t log back into wp dashboard… but I need the snippet plugin because it helps run my site smoother. Is there a way to fix the plugin while it’s activate and not crash my website? I tried to look into safe mode plugins but none looked good. :-/ I don’t know how to fix this so my site is working fine.

    I’m receiving this error message at the bottom it says:

    plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code(1): get_sidebar(‘footer-widget-a…’) #7 /home/myname/public_html/mysite.com/wp-content/plugins/code-snippets/php/snippet-op in /home/myname/public_html/mysite.com/wp-includes/query.php on line 28 There has been a critical error on your website

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Code Snippets Crashes my site’ is closed to new replies.