How to customize the critical error message saying:

There has been a critical error on your website.

Learn more about debugging in WordPress.

Instead of using CSS to hide the message it would be interesting to be able to point the link to another source than the community article.

1 Answer 1


You can use the wp_php_error_message filter to customise this message:

    function( $message, $error ) {
        return 'My custom message.';

I haven't tested to be sure, but I would assume that if the critical error that causes this message happens to be in the code of same theme or plugin that this filter is used in, or a theme or plugin loaded before it, then this filter would likely not apply.

If you want to change this message independently of your theme and plugins, this might be a good use case for a Must Use Plugin.

  • Indeed I am planing to implement it via a mu plugin together with the shutdown hook to perform recovery/debug actions. I will test this and let you know, thanks!
    – RafaSashi
    Commented Jul 12, 2020 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.