Hide php Notices in Dashboard

When I program a theme, I put WP-DEBUG on. Which ensure a proper PHP code.

Sadly most Plugin developers keep using non existing vars :

echo $args['title'];

Notice: Undefined index: title in /wp-content/plugins/easy-fancybox/easy-fancybox.php on line 301

Instead of

echo ( isset($args['title']) ? $args['title'] : '' );

So I permanently get tens of Notice errors with some plugins (even MU gets one !)

Thanks to a Debugbar I don’t see them on my websites, not in the middle, they are all deported to the bottom.

But how could I hide them in the Dashboard the same way? I would like to push them to the bottom of the page.

UPDATE: Actually, Debugbar hides them in Admin and Website the same way, I just didn’t notice that it didn’t work for this particular plugin for once. Notices errors were between <script> tags

1
1

I don’t know how to move the notices to the bottom or if that’s possible at all. To disable the debug mode in wp-admin write in wp-config.php:

define( 'WP_DEBUG', FALSE === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) );

Untested:

You could try to enable warnings in admin with:

// happens early in wp-admin/admin.php
add_filter( 'secure_auth_redirect', 'wpse_67728_error_warnings' );

function wpse_67728_error_warnings( $in )
{
    // anything but notices
    error_reporting(E_ALL ^ E_NOTICE);
    return $in;
}

Leave a Comment