Overriding the suspension page in WPMU

From ceejayoz

Jump to: navigation, search

WPMU uses the function graceful_fail to output suspension, deletion, spam, etc. notices. These notices are very boring in appearance and offer no links to the main WPMU install, no explanation, nothing - just a nondescript error.

There is a graceful_fail filter (by the same name) that is intended to be used on the message itself, but as this filter executes before the die() function is called, we can write a plugin that outputs a custom error page of our choosing, then calls die() or exit() to prevent the default page from ever showing up.

[edit] Code

This goes in WPMU's mu-plugins folder.

<?php
 
add_filter('graceful_fail', 'nice_graceful_fail');
 
function nice_graceful_fail($message) {
  // output your HTML template here - be sure to print $message out
  // I created a suspended.html file in wp-content and required it, like so:
  require_once(WP_CONTENT_DIR . '/errors/suspended.html');
  exit;
}
Personal tools