Getting wp_error breaks
-
[ Moderator note: moved to How-to and Troubleshooting. ]
I have been using the following code to access WordPress errors; however, recently, this stopped working. It breaks any code following it and if submitting a form, leads to 500 page error. I have tried putting it in a try/catch, but the code somehow still breaks.
I use this to get the errors, which appears to work fine.
public static function GetErrors() { static $wp_error; return isset($wp_error) ? $wp_error : ($wp_error = new WP_Error(null, null, null)); }
Then I use this to get the error codes, which is what breaks.
\MyNamespace\MyStaticClass::GetErrors() -> get_error_codes()
- The topic ‘Getting wp_error breaks’ is closed to new replies.