Recovering from Fatal PHP Errors in SnipVault

Written By mark@uipress.co

Last updated 12 months ago

While SnipVault includes robust error catching to prevent problematic code from breaking your WordPress site, some PHP errors can still slip through and cause issues. This guide explains how to recover from fatal errors or white screen of death (WSOD) situations caused by custom code snippets.

Understanding the Safety Net

SnipVault has an important built-in safety feature: snippet code never runs on the SnipVault admin page itself. This means that even if your custom code breaks your site, you'll always have a way to access the SnipVault interface to disable the problematic snippet.

If Your Site Goes Blank or Shows Fatal Errors

If you've just activated a snippet and your WordPress site displays a blank white screen or a fatal error message, follow these steps to recover:

  1. Access SnipVault directly by navigating to:

    /wp-admin/options-general.php?page=snipvault#/ 
  2. This URL bypasses the normal WordPress admin interface and takes you directly to the SnipVault management page

  3. Find the problematic snippet in your snippet list (likely the most recently activated one)

  4. Either:

    • Toggle off the Autoload setting for the snippet

    • Edit the snippet to fix the code error

    • Delete the snippet entirely if it's no longer needed

  5. Click Save to apply your changes

  6. Your site should now function normally again when you visit other pages

Preventative Measures

To avoid fatal errors in the first place:

  1. Test snippets on a staging site before deploying to production

  2. Start with Autoload set to "No" for new snippets until you've verified they work correctly

  3. Use try/catch blocks in your PHP code to handle potential errors gracefully:

    try { 
    // Your potentially problematic code here 
    } catch (Throwable $e) { 
    // Log the error or handle it gracefully 
    error_log('SnipVault snippet error: ' . $e->getMessage()); 
    } 
  4. Add conditional checks before executing functions or accessing objects/variables

  5. Incrementally build complex functionality rather than adding large blocks of untested code

If You Can't Access the Admin Area At All

In rare cases where you can't access the SnipVault interface, you can disable snippets through the file system:

  1. Connect to your server via FTP or file manager

  2. Navigate to /wp-content/uploads/snipvault/

  3. Temporarily rename the folder (e.g., to snipvault-disabled) or move the specific problem snippet file

  4. Access your site again - it should now load without the problematic snippet

  5. Fix the issues in the SnipVault interface and restore the file/folder

Advanced Recovery: wp-config.php Method

If all else fails, you can temporarily disable all PHP snippets by adding this line to your wp-config.php file:

define('SNIPVAULT_DISABLE_PHP_SNIPPETS', true); 

This will prevent all PHP snippets from executing while still allowing you to access your WordPress admin and the SnipVault interface to fix the issues.

Remember to remove this line after resolving the problems to re-enable your snippets.

Getting Help

If you're still experiencing issues after trying these recovery methods, reach out to SnipVault support with:

  • Details about the error message (if visible)

  • Information about what the snippet was trying to accomplish

  • Steps you've already taken to resolve the issue

The SnipVault team can help you troubleshoot and resolve persistent problems.