SnipDrop
Add tested code snippets to your WordPress and WooCommerce site with one click. No coding required.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/shameemreza/snipdrop/archive/refs/heads/main.zipReadme
=== SnipDrop === Contributors: shameemreza Tags: code snippets, woocommerce, php snippets, wpcode, customization Requires at least: 6.0 Tested up to: 6.9 Stable tag: 1.0.0 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html
Add tested code snippets to your WordPress and WooCommerce site with one click. No coding required.
== Description ==
= Curated Code Snippets for WordPress and WooCommerce =
SnipDrop takes a different approach to code snippets. Instead of asking you to write or paste code, it provides a library of pre-tested snippets that you simply enable with a toggle.
Every snippet in SnipDrop has been tested and verified to work. You do not need to copy code from blog posts, paste it into your functions.php, and hope it works. Just find the snippet you need, enable it, and you are done.
= Who is SnipDrop for? =
SnipDrop was built for store owners, site administrators, and developers who want quick solutions without the hassle of managing code manually.
If you have ever searched for "how to change WooCommerce button text" and found yourself copying code from five different websites, SnipDrop is for you.
= How it works =
- Browse the snippet library by category.
- Find a snippet that does what you need.
- Toggle it on.
That is it. The snippet runs immediately. No page refresh needed, no code editing required.
= Key Features =
- Curated Library: Pre-tested snippets that work out of the box.
- One-Click Toggle: Enable and disable snippets instantly.
- Configurable Snippets: Change settings like button text or IDs without touching code.
- Global Header & Footer: Insert custom scripts into your site header, body open, and footer from a dedicated page with CodeMirror editors.
- Smart Conditional Logic Builder: A visual rule builder with AND/OR groups, 20+ condition types, and Show/Hide logic to control exactly where and when snippets run.
- Testing Mode: Preview snippet changes in a sandbox visible only to admins. Publish or discard when ready — visitors never see untested code.
- Activity Log: Track every snippet lifecycle event — enables, disables, edits, errors, imports, and settings changes — with filtering and pagination.
- 7 Plugin Importers: Migrate from WPCode, Code Snippets, Code Snippets Pro, Woody Snippets, Simple Custom CSS and JS, Header Footer Code Manager, and Post Snippets with one click.
- Custom Named Shortcodes: Give your custom snippets a named shortcode (e.g.,
[my-banner]) for easy placement anywhere. - WooCommerce Locations: Auto-insert snippets before/after shop loops, single products, cart, checkout form, and thank-you page.
- After-Paragraph Insertion: Insert snippets after a specific paragraph number in post content.
- Compatibility Checker: See at a glance whether your PHP version, WordPress version, and plugins meet a snippet's requirements before you enable it.
- Conflict Detection: Warns you when two active snippets hook into the same WordPress action or filter, with high-risk alerts for critical hooks.
- Performance Badges: Every snippet shows its expected performance impact — Lightweight, Moderate, or Heavy — so you can make informed decisions.
- Email Error Alerts: Get an email notification when a snippet is auto-disabled due to an error, with rate limiting to prevent flooding.
- Visual Diff for Revisions: Compare any revision to the current code with a line-by-line diff view highlighting added, removed, and unchanged lines.
- Custom Code Editor: Full PHP, JS, CSS, and HTML support with syntax highlighting.
- Editor Dark Mode: Toggle dark mode in the code editor for comfortable coding.
- Tags: Clickable tags on library snippets for quick filtering, plus custom tags on your own snippets.
- Copy to My Snippets: Copy any library snippet and customize it to fit your needs.
- Import & Export: Move snippets between sites with JSON export/import.
- Code Auto-Detection: Paste code and the editor automatically detects PHP, JS, CSS, or HTML.
- Snippet Revisions: Previous versions of your custom snippets are saved automatically.
- Search & Bulk Actions: Search My Snippets and manage multiple snippets at once.
- Grid & List View: Toggle between grid and list view on the library page.
- Admin Bar Quick Access: See active snippet count and quick links from the WordPress admin bar.
- Keyboard Shortcut: Save snippets with Ctrl+S / Cmd+S.
- Developer Hooks: Actions and filters for extending SnipDrop programmatically.
= Smart Conditional Logic =
Control exactly where and when your snippets run with a visual rule builder:
- AND/OR Groups: Combine conditions with AND logic within groups and OR logic between groups for precise targeting.
- Show/Hide Logic: Choose to show or hide snippets when conditions are met.
- User Conditions: Logged-in state, user role (multi-select from your site's roles).
- Page Conditions: Post type, specific pages/posts (AJAX search picker), page type (front page, home, single, archive, search, 404).
- URL Patterns: Match URL paths with wildcard support (e.g.,
/shop/*,/checkout). - Taxonomy Terms: Categories, tags, product categories, or any custom taxonomy.
- Schedule: Start and end dates, before/after specific times, day of week.
- Device Targeting: Desktop or mobile (uses
wp_is_mobile()). - WooCommerce Conditions: Cart total thresholds, product in cart, customer role, and more (when WooCommerce is active).
- Run Location: Everywhere, frontend only, admin only, or specific auto-insert locations.
= Testing Mode =
Make changes to your snippets without affecting live visitors. When Testing Mode is enabled, your edits are saved to a staging area. Only administrators see the staged version. When you are ready, publish all changes at once or discard them. Visitors continue seeing the live, stable version throughout.
= Activity Log =
A dedicated page tracks every important event in your snippet workflow:
- Snippet enabled, disabled, created, updated, or deleted.
- Failed activation attempts with error details.
- Import events from JSON files or other plugins.
- Settings changes and testing mode publish/discard events.
- Filter by event type, paginate through history, and clear when needed.
= Error Protection =
- Automatic Error Detection: Snippets that cause PHP errors are disabled automatically.
- PHP Syntax Validation: Code is checked for syntax errors before activation — works reliably across all hosting environments including shared hosting, managed WordPress, and local development tools.
- Email Error Alerts: Receive email notifications when a snippet is auto-disabled. Rate-limited to one email per 15 minutes. Configurable in Settings.
- Safe Mode: Disable all snippets at once if something goes wrong — including global header/footer scripts.
- Recovery URL: A secret URL that enables safe mode even if you cannot access the admin.
- Suspicious Code Detection: Warns about potentially dangerous code patterns before saving.
- File-Based Error Logging: Errors are logged with timestamps and line numbers.
= Import from Other Plugins =
Switching to SnipDrop? Import your existing snippets from any of these plugins:
- WPCode (free and premium)
- Code Snippets (free)
- Code Snippets Pro
- Woody Code Snippets
- Simple Custom CSS and JS
- Header Footer Code Manager
- Post Snippets
All imported snippets are set to inactive for safety. Original code, settings, and metadata are preserved. An imported-{source} tag is automatically added for easy identification.
= Custom Capabilities =
SnipDrop uses a custom sndp_manage_snippets capability. Administrators get it automatically, and you can grant it to other roles (e.g., Editor) using any capability manager plugin; without giving them full manage_options access.
= Smart Badges =
SnipDrop gives you detailed insight into every snippet before you enable it:
- Compatibility Badges: Each library snippet shows whether your environment meets its requirements. Incompatible snippets are clearly marked in red, and their toggles are disabled to prevent errors.
- Requirement Pills: See exactly what a snippet needs — "WooCommerce 10.0+", "PHP 8.0+", etc. — at a glance on every card.
- Conflict Detection: When two active snippets register callbacks on the same WordPress hook, SnipDrop shows an orange "Potential Conflict" badge. For critical hooks (checkout, pricing, login), the badge turns red.
- Performance Weight: Every snippet is classified as Lightweight, Moderate, or Heavy based on what the code does. Custom snippets are analyzed automatically when you save them.
- Custom Code Analysis: When you save a custom PHP snippet, SnipDrop checks for PHP version requirements, plugin dependencies, and performance patterns — and warns you before anything breaks.
= Snippet Categories =
- WooCommerce Checkout: Customize buttons, fields, and checkout flow.
- WooCommerce Cart: Modify cart behavior and appearance.
- WooCommerce Products: Change product display and pricing.
- WooCommerce Subscriptions: Customize subscription behavior.
- WooCommerce Product Add-Ons: Modify add-on display and logic.
- WooCommerce Product Bundles: Customize bundle behavior.
- WooCommerce Bookings: Modify booking display and flow.
- WooCommerce Tools: Utility snippets for store management.
- WordPress Admin: Customize the admin dashboard.
- More categories added regularly.
= Configurable Snippets =
Some snippets include configurable options. Instead of editing code, you simply fill in a form. For example, to change the checkout button text, just type your desired text in the settings field. No coding required.
= Custom Snippets =
For developers and advanced users, SnipDrop includes a full code editor to create your own snippets. Write PHP, JavaScript, CSS, or HTML code with syntax highlighting and save it alongside the curated library.
You can also copy any library snippet to My Snippets and customize the code to fit your specific needs.
= Source Attribution =
Many snippets in the library come from official documentation, community contributions, and trusted sources. Each snippet includes attribution where the original source is known, giving proper credit to the developers who shared their solutions.
== Installation ==
- Upload the
snipdropfolder to/wp-content/plugins/or install through the WordPress plugin screen. - Activate the plugin through the Plugins screen.
- Go to SnipDrop in your admin menu.
- Click Sync Library to fetch available snippets.
- Enable the snippets you want to use.
== Frequently Asked Questions ==
= Do I need coding knowledge to use SnipDrop? =
No. SnipDrop is designed for non-developers. You browse, enable, and the snippet works. However, you can view the code for any snippet if you want to understand what it does.
For advanced users, the My Snippets feature provides a full code editor to create custom snippets.
= What happens if a snippet breaks my site? =
SnipDrop automatically detects PHP errors. If a snippet causes a fatal error, it gets disabled immediately to protect your site. You can also use the recovery URL (found in Settings) to enter safe mode and disable all snippets at once.
= Will snippets survive theme updates? =
Yes. Snippets are stored in the WordPress database, independent of your theme. Updating or changing your theme will not affect your enabled snippets.
= Can I customize library snippets? =
Yes. For configurable snippets, you can change settings like text values and IDs without touching any code. For full customization, use the Copy to My Snippets feature to create your own editable version.
= Can I add my own custom code? =
Yes. Go to SnipDrop > Add New to create custom PHP, JavaScript, CSS, or HTML snippets with a full code editor. You get syntax highlighting, dark mode, and all the conditional execution options.
= Can I use a custom shortcode name? =
Yes. When creating a custom snippet, you can set the Run Location to Shortcode and define a custom name like my-banner. Then use [my-banner] anywhere in your content. The default [snipdrop id="..."] shortcode also works.
= Can I add scripts to my site header and footer? =
Yes. Go to SnipDrop > Header & Footer to add custom code to your site's <head>, after <body>, and before </body>. This is ideal for analytics tracking codes, custom CSS, chat widgets, and verification tags.
= Can I schedule a snippet to run only during a specific period? =
Yes. Each snippet has scheduling options where you can set a start date, end date, time constraints, and even specific days of the week. The snippet will only execute within that window.
= Can I restrict a snippet to specific pages or URLs? =
Yes. The conditional logic builder lets you target snippets by post type, specific post/page IDs, page type (front page, archive, search, 404), URL patterns with wildcards, taxonomy terms, device type, user role, and more — all combinable with AND/OR logic.
= Can I test snippet changes before going live? =
Yes. Enable Testing Mode from the Settings page or admin bar. Your changes are saved to a staging area that only administrators can see. When satisfied, publish all changes at once. Visitors always see the stable live version.
= Can I import snippets from other plugins? =
Yes. SnipDrop can import from WPCode, Code Snippets, Code Snippets Pro, Woody Snippets, Simple Custom CSS and JS, Header Footer Code Manager, and Post Snippets. Go to My Snippets and look for the Import from Plugin option. You can also import from SnipDrop's own JSON export format.
= Can I export my snippets? =
Yes. Go to My Snippets and click Export to download all or selected snippets as a JSON file.
= Can I give editors access to snippets without making them administrators? =
Yes. SnipD