Help! My site broke! How can I fix it?
updated 9 months ago
If you have just activated a snippet and now your entire site has crashed, leaving only a white screen or an error message, don't panic! We have a feature built just for this purpose, and it's called safe mode.
While safe mode is active, all snippets will be temporarily 'paused', allowing you to access your site and deactivate the snippet that is causing the error. Both of the methods described below will work, though generally the per-page method is easiest to enable.
To activate safe mode, add the following line to your wp-config.php file, just before the line that reads
/* That's all, stop editing! Happy blogging. */:
define( 'CODE_SNIPPETS_SAFE_MODE', true );
To turn safe mode off, either comment out this line or delete it.
You can enable safe mode on a per-page basis by appending
&snippets-safe-mode=1 to end of the current page’s URL. While safe mode is active, all snippets will not execute, allowing you to login to your site and deactivate any snippets that are causing issues.
For example, to see the WordPress admin area in safe mode, you would change the URL from this:
… to this:
Or, for another example, if you were viewing a page on the front-end of your site, you could change a URL like this:
… to this:
This will only work if the current user is logged in as an administrator – other visitors will see your site as normal.
If you would like a shortcut to turn on safe mode for the current page, create a new browser bookmark and paste this in as the URL: