Server Admin Email for code-level maintenance notifications

  1. David Sword


    Typically a full time WP developer is responsible for a WordPress website build, it's environment, and the client is the WordPress admin_email handling things on that side. Especially for WordPress Networks, 1 server_admin with tons of clients who admin their respective WordPress sites.

    Over years the Developer may have dozens of sites that s/he does not monitor regularly, and rely on his clients telling him when/if there's an critical error. Typically database and other errors happen silently.

    I suggest creating an optional SERVER_ADMIN constant in wp-config.php to help the WP developer be notified of anything critical:

    define('SERVER_ADMIN', 'wpdeveloper@example.com');

    Then on critical code error points, like:


    Add in something like:

    // tell server admin of the db failure
    if (defined( 'SERVER_ADMIN' ))
      if (!$already_sent_email_today) // some local write cache file
        mail(SERVER_ADMIN, 'Server Database Error', print_r($_SERVER,true).$wpdb->error);

    Before the silent HTML error page. Notifying the Server Admin of the critical error.


    An instance where this is handy is if the MySQL database is out of resources. That error occurs silently and sporadically, and will cause a database failure only for a short time, as it's being maxed, the db will run fine again once the requests go down - unbeknown to the server admin (unless monitoring server-side logs).

    Posted: 1 year ago #

RSS feed for this topic


You must log in to post.

  • Rating

    1 Vote
  • Status

    This is plugin territory