Title: When does snippets run
Last modified: August 18, 2021

---

# When does snippets run

 *  [sgumby](https://wordpress.org/support/users/sgumby/)
 * (@sgumby)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/when-does-snippets-run/)
 * Can you please add to your documentation on this site when this runs in relation
   to functions.php?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [sgumby](https://wordpress.org/support/users/sgumby/)
 * (@sgumby)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/when-does-snippets-run/#post-14781500)
 * Sorry….followup. How does this handle errors that would normally cause php to
   crash?
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/when-does-snippets-run/#post-14853141)
 * Hi [@sgumby](https://wordpress.org/support/users/sgumby/),
 * I’ve added a page to our help documentation that explains [where snippets are executed in the WordPress load order](https://help.codesnippets.pro/article/45-snippets-in-wordpress-load-order).
   Please let us know if you’d like more detail to be added or something is missing
   from the article.
 * In relation to error avoidance, there are a few stages. The first is a live linter
   that checks your PHP code as you write it in the editor. This uses a library 
   to do general PHP syntax checking, while also checking that there are no duplicated
   classes or functions within the snippet.
 * When you save a snippet, a second set of validation is run, where the code is
   broken into tokens, allowing for some basic syntax checking, and then the result
   is once more checked for duplicate identifiers. The important differentiator 
   in this step from the first one is that the new functions and classes can be 
   checked against those already existent on the site from WordPress core, themes,
   and other plugins.
 * Finally, the snippet code is then evaluated before it is saved to the database.
   This ensures that buggy code is not permanently saved and any errors can be recovered
   from.
 * In the odd case when a buggy snippet is active on your site, Code Snippets includes
   a [built-in safe mode feature](https://help.codesnippets.pro/article/12-safe-mode)
   to temporarily halt all snippets from running, allowing you to access your site
   and manually fix the problem.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘When does snippets run’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/when-does-snippets-run/#post-14853141)
 * Status: not a support question