Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use the wp_die_handler to alter your frontend dead
<?php
/**
* Plugin Name: Schöner Sterben mit wp_die()
* Plugin Author: David Remer/Websupporter
**/
add_filter( 'wp_die_handler', 'die_in_beauty_filter' );
function die_in_beauty_filter( $die_handler ) {
if ( is_admin() ) {
return $die_handler;
}
return 'die_in_beauty';
}
function die_in_beauty( $message, $title, $args ) {
get_header();
if ( empty( $title ) ) {
$title = 'Ein Fehler ist aufgetreten';
}
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<article class="error">
<header class="entry-header">
<h1><?php echo $title; ?></h1>
</header>
<div class="entry-content">
<?php echo apply_filters( 'the_content', $message ); ?>
</div>
<footer class="entry-footer">
<p style="text-align:center;font-size:6rem;">😲</p>
</footer>
</article>
</main>
</div>
<?php
get_sidebar();
get_footer();
die();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment