Created
March 24, 2021 01:59
-
-
Save KevinBatdorf/dad7288386a3ab8656b123170625b50b to your computer and use it in GitHub Desktop.
Add a Ray by Spatie helper to catch WP Errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Create a file at wp-content/mu-plugins/ray-wp-error-helper.php and add this entire gist | |
* https://myray.app/ | |
*/ | |
add_action('wp_error_added', function ($code, $message, $data, $wp_error) { | |
ray($wp_error); | |
ray()->trace(); | |
}, 10, 4); |
To generate the above, I had this in my code, but that filter will pick up on all internal WP errors as well as any custom errors.
new \WP_Error('example_error', __('Something really bad is happening.'), ['user' => get_current_user()]);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should see something like this:
