WordPress.org

Ready to get started?Download WordPress

Forums

Graceful redirect in case of database error (5 posts)

  1. jokersson
    Member
    Posted 6 years ago #

    Is it possible to have the page redirected to a landing page when the database connection is broken? This would be more presentable, rather than the default WordPress database error page. Any idea if this could be done? Cheers!

  2. whooami
    Member
    Posted 6 years ago #

    sure.. its already done actually

    take a look at wp-includes/functions.php

    the last function, dead_db

    you can see what its doing right there. Notice the file it looks for??

    theres your landing page :)

  3. Maxormark
    Member
    Posted 6 years ago #

    I can't find any mention of this wonderful function anywere: not on the web, not in my Worpress installations, nowhere.
    Could you please be a little more explicit?

  4. whooami
    Member
    Posted 6 years ago #

    Maxormark,

    What is more explicit than saying the file name?

    wp-includes/functions.php

    and saying its the last function.

    Maybe you are not looking in the right version -- I typically provide answers using the most recent version as a starting point.

  5. Khairil Zhafri
    Member
    Posted 6 years ago #

    Create a custom page named db-error.php in /wp-content/.

Topic Closed

This topic has been closed to new replies.

About this Topic