WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to customize the WordPress>error page template so that the user isn't shown just a blank screen with text?

I'm not talking about 404, but when WordPress displays an error.

I'd like to style this page to match my theme.

share|improve this question
Could you give an example of what kind of error you're talking about? – Johannes Pille Jun 8 '12 at 18:37
If you look at the link that Michael put below, that's what I'm talking about. – plumwd Jun 8 '12 at 20:53
up vote 6 down vote accepted

You're probably talking about theming wp_die(), which is the function that produces those grey error pages with a white box of text in them.

For a plugin solution, you could try this plugin, which says it does what you want. Not sure about version support though--it says it only works up to 3.1.4.

For a programatic solution, you'll want to hook into the filter "wp_die_handler". So you can do:

add_filter('wp_die_handler', 'my_die_handler');

As far as code for the "my_die_handler" function, you could start by looking at the default die handler--the function is called "_default_wp_die_handler", and it starts on line 2781 of the core file /wp-includes/functions.php. You can copy the whole function to your plugin file (or your theme's functions file), rename it "my_die_handler", and customize it form there.

share|improve this answer
Thanks for this Matt, will check it out. – plumwd Jun 8 '12 at 20:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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