Code Snippets Code Snippets Plugin WordPress WordPress Tutorials

How to disable a Code Snippet from Database in WordPress

Everyone think that code snippets plugin is something that you can use to install any PHP code on WordPress without breaking the site. I encountered an issue today, when I was making snippet to block unwanted query strings URLs in WordPress. Like me, you can also end up breaking your site if you using code snippets plugin, so after some research I found the solution that will help you to disable code snippet from database if you have ever end up breaking your WordPress site with code snippets plugin.


1. How to Disable a Code Snippet from WordPress Dashoard

To disable a snippet that you’ve added via the Code Snippets plugin in WordPress, follow these steps:

  • Go to Snippets
  • You will see a list of all the snippets, look for the snippet you want to disable.
  • You might see a toggle switch next to the snippet’s title. Simply turn it off to disable the snippet.
  • If there’s no toggle, you can check the box next to the snippet and use the bulk actions drop-down menu at the top to select Deactivate and then click Apply.
Disable a Code Snippet from WordPress Dashoard

If you can’t access the dashboard or the plugin interface, you may need to disable the snippet from database. I have shared the method on how to disable a code snippet from database below although the above method is the simplest.

2. How to Disable a Code Snippet from Database

If you don’t have access to the WordPress dashboard, you can disable the snippet from database by using database tools like phpMyAdmin.

  • Log in to your hosting account & open phpMyAdmin database management tool.
  • In phpMyAdmin, choose database associated with your WordPress installation.
  • Look for database table wp_snippets (where wp_ is your table prefix, which could be different for your installation).
  • Browse the wp_snippets table to find the snippet you want to disable.
  • Now, in the active column you can se 1 & 0 (1 means active and 0 means disable)
  • Just change the active status to 0 for whichever snippet you want to disable.

Now, you can access your WordPress if you have successfully disabled the snippet which broke your site.

We strongly advice you to take a site backup before you go about making any changes to your database.

Note: You have a full backup of your database and site.

If you’re unsure or uncomfortable with these steps, it’s a good idea to consult a professional or reach out to your hosting provider for assistance.