Prevent Deprecation Notice Logging

Last updated by Matt Beckett

Many community plugin still have deprecated code.  I know about it, but I'm working on other stuff at the moment, and in the meantime my apache logs are just being filled with them on every pageload.

//hook handling register should be in the global scope outside of your init function

// otherwise it will miss any deprecation inside plugins that init before yours

elgg_register_plugin_hook_handler('debug', 'log', 'myplugin_deprecation_log');


function myplugin_deprecation_log($hook, $type, $returnvalue, $params){

    // look to see if it's a deprecation notice, if so return false
    if($params['level'] == 'WARNING' && !$params['to_screen'] && substr($params['msg'], 0, 13) == 'Deprecated in'){
      return FALSE;

Matt Beckett

I'm a self-employed web developer, family man, nerd, scuba diver. Manager/maintainer of this elgg community site, and core Elgg development team member.