How to stop certain warning logging in error.log?

bbPress has an annoying error about bbp_setup_current_user was called incorrectly. bbPress topic and bbPress ticket #2412, and it looks like nothing will change to fix it.

On the site we used to use forum as a support platform, but has since then moved to a ticket system, so I've closed the forums, but you can look through them. I've also commented out the notice that was thrown in the backend because of it, but the problem is that the error.log on the server is filled with such errors (it's 85MB during the last 4 days). It's all like this:

[Fri Aug 26 02:00:52.251831 2016] [:error] [pid 1832] [client xx.xx.xx.xx:32824] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bbp_setup_current_user' not found or invalid function name in /var/www/html/wp-includes/plugin.php on line 524

So is there any kind of command I can use to suppress the writing of this specific warning in the error log? I'd still like to have possible errors written here.

Topic logging errors Wordpress

Category Web


/ Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Check this


"Technically" it's just a PHP warning and not an error, and you should not have warnings enabled on production servers. You can disable PHP from logging warnings and it will still log errors to the error log file.

You can disable PHP warnings by setting it in a custom php.ini file on the server (all errors except for warnings): error_reporting = E_ALL & ~E_WARNING

or try setting it with PHP:

error_reporting(E_ALL & ~E_WARNING);

From php.ini file:

; Common Values:
;   E_ALL (Show all errors, warnings and notices including coding standards.)
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices)
;   E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errors, except for notices and coding standards warnings.)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.