[Bug] Trashing a snippet in Network Admin activates it
-
Hello, I discovered when using Multisite, trashing a network snippet activates it regardless of its previous state. The Trash essentially functions as a hidden “enabled snippets” list. This is counterintuitive and potentially dangerous behavior.
Steps to Reproduce
- Open this WordPress Playground with Multisite: https://playground.wordpress.net/?multisite=yes&plugin=code-snippets&url=/wp-admin/network/admin.php?page=add-snippet
- Add this test code below:
add_action('wp_footer', 'snippet_active_banner'); add_action('admin_footer', 'snippet_active_banner'); function snippet_active_banner() { echo '<div style="position:fixed;bottom:0;left:0;right:0;background:#4caf50;color:#fff;text-align:center;padding:10px;font-weight:600;z-index:999999;">✓ This Code Snippet is active!</div>'; }- Click Save and Activate, navigate back to All Snippets → green banner appears
- Deactivate the snippet → green banner disappears
- Trash the deactivated snippet
- Bug: Green banner reappears → trashing has activated the snippet
Observations
Trashing an inactive snippet → becomes active until deleted from Trash
Trashing an active snippet → remains active until deleted from Trash
Expected Trashing should deactivate a snippet. Trashed snippets should never execute.
Actual Trashing activates the snippet. All trashed snippets execute their code.
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.