Title: Removed code snippet but code persists
Last modified: May 1, 2023

---

# Removed code snippet but code persists

 *  [shaunmehr](https://wordpress.org/support/users/shaunmehr/)
 * (@shaunmehr)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/removed-code-snippet-but-code-persists/)
 * I created a code snippet to add a few additional user roles, but realized that
   I could do this with Advanced Access Manager. I tried to deactivate the code 
   snippet but the new user roles still appeared throughout the site. I tried deleting
   the code snippet and still persisted. Finally I tried to delete the user roles
   using the AAM plugin – it worked for the first three but the last one is not 
   able to be deleted. I understand the code PHP code snippets are added to the 
   database – is there some manual way I can isolate the snippet that I tried to
   delete and remove it? Also, I have tried clearing the cache on my site and the
   object cache with my host with no difference.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/removed-code-snippet-but-code-persists/#post-16705728)
 * Hi [@shaunmehr](https://wordpress.org/support/users/shaunmehr/),
 * Modifying user roles is a permanent action. Unlike when using action and filter
   hooks, changes to users are written to the database, meaning they only need to
   happen once, and so are best suited for a run-once snippet.
 * The code you added would have stopped running when you deactivated the snippet,
   but the changes you made will still be there.
 * The only way to undo your changes is to work out what you did, and then apply
   further functions to restore to how things were before (e.g. removing roles you
   added, etc), or to restore from an older database backup.

Viewing 1 replies (of 1 total)

The topic ‘Removed code snippet but code persists’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/removed-code-snippet-but-code-persists/#post-16705728)
 * Status: not a support question