thebrandonallen / wp-fail2ban-redux

Records various WordPress events to your server's system log for integration with Fail2Ban.
GNU General Public License v2.0
63 stars 13 forks source link

Enabling filters generates PHP warnings #5

Closed ahmed-sigmalux closed 6 years ago

ahmed-sigmalux commented 7 years ago

I created a custom plugin with the following add_filter entries:

add_filter( 'wp_fail2ban_redux_block_user_enumeration', '_return_true' );
add_filter( 'wp_fail2ban_redux_log_pingbacks', '_return_true' );
add_filter( 'wp_fail2ban_redux_log_spam_comments', '_return_true' );

And now I'm seeing hundreds of these entries in my debug.log:

[27-Sep-2017 06:07:07 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_return_true' not found or invalid function name in /var/www/mysite.com/wp-includes/class-wp-hook.php on line 298

thebrandonallen commented 7 years ago

Sorry about that. I just realized the examples on the Wiki are wrong. It should be __return_true, instead of _return_true. Note that the correct version uses two leading underscores. I'll get the Wiki fixed.