The MU forums have moved to WordPress.org

Custom Graceful Fail error (8 posts)

  1. bloggsbe
    Member
    Posted 15 years ago #

    Hi!

    I've made a small plugin that gives you the possibility to set your own message to show when someone tries to access a blog that has been archived or is a spamblog. You can also make the page return a 404 code (normally it's a 200).

    There is one catch. I don't like to do this, but you have to add one line to your wp-config file. I know the Graceful fail function is supposed to be pluggable, but I could not get it to work...

    So, you have to put require_once(ABSPATH.'graceful_fail.php'); in your wp-config.php BEFORE require_once(ABSPATH.'wp-settings.php');, that is to make sure that OUR graceful_fail() loads first.

    Thats why the plugin is in two files. The graceful_fail.php goes in the root (where your wp.config is), and the file graceful_fail_admin.php goes in your mu-plugin folder.

    Since you don't edit any other files, it should survive upgrades - since you normally don't do anything with the mu-plugins folder or the wp-config.php

    The rest is done in your dashboard.

    If you like to give it a try, you can download it here!

    Regards,
    Rune

  2. bloggsbe
    Member
    Posted 15 years ago #

    I noticed this in the trac => http://trac.mu.wordpress.org/ticket/705

    I've updated the Custom Graceful Fail error plugin so you now can choose either a 404 status or a 410 status header.

    The download link remains the same.

    Regards,
    Rune

  3. andrea_r
    Moderator
    Posted 15 years ago #

    Oh, I think I'm gonna try this.

    (really! I mean it this time.)

  4. selad
    Member
    Posted 15 years ago #

    Thanks. I'd rather a hook would be added to the function to avoid the change to core.

  5. bloggsbe
    Member
    Posted 15 years ago #

    AFAIK the graceful_fail() function is supposed to be "hookable", I just don't get it to work.

    If I'm wrong about the graceful_fail() function, please correct me :-)

    But you don't do any changes to the core. The config file you have to edit anyway, to put in your secret keys and what not, the rest is simply to drop one file in the same place as your wp-config.php file is, and one in to the MU-Plugins folder - as any other plugin...

    So it's also "upgrade safe".

    And Andrea - it's 'bout time :-)

    --
    R

  6. andrea_r
    Moderator
    Posted 15 years ago #

    :P

    feel free to send me a list of stuff I forgot if you like.

    :D

  7. bloggsbe
    Member
    Posted 15 years ago #

    Just an update of the download location.

    New download location

    --
    RG

  8. andrea_r
    Moderator
    Posted 15 years ago #

    They've rolled something like this into trac recently. Like possibly yesterday. :D

About this Topic

  • Started 15 years ago by bloggsbe
  • Latest reply from andrea_r