OK, now that I installed WordPress and customized the Royal theme enough to suit my own megalomania and my girlfriend’s taste, I try to post an empty test comment, expecting a nice error message, and… ouch! the digest authentication prompt guarding my administration directory?! why?
A quick grep reveals that the
uses its own hardcoded template, linking many assets under the protected
Looks like an “idea” about Modular error pages/a way to override wp_die exists in the Wordpress Ideas vault since two weeks ago. Good.
But I need them now, themed error pages. It’s a matter of decency!
Luckily, it’s quite easy, even if a wonderfully dirty hack…
- Create a new page (
) called “Error”, containing just the following code (be sure you write this in the “Code” tab):<!–ERROR_MESSAGE–>
Double check that it’s shown using the URL http://yourhost.com/path/to/your/blog/error
- Open the
file in a text editor and locate the lineif (strpos($_SERVER[’PHP_SELF’], ‘wp-admin’) !== false)
(should be around line 1340 in WP 2.2)
- Place the following code just before the line you’ve just located
file_get_contents(get_option(’siteurl’) . ‘/error’)));
Don’t forget that you’ve just hacked a core WordPress file, so you’ll have to repeat this operation on next upgrade… unless they add this feature, as we sincerely hope, or you mistyped something and just annihilated your blog. RIP.