On a particular project we need to completely bypass Akismet for certain users.
So I was hoping that using pre_comment_approved
filter and returning one
for those users who we want to “whitelist”, would do it, but clearly Akismet still scans these users’s comments and flags them as spam (but we trust these users and do NOT want Akismet to scan these particular users’ comments.
This was the code used:
function prefix_auto_approve_comments_by_role( $approved, $commentdata ) { $user = wp_get_current_user(); $allowed_roles = array( 'role_1', 'role_2' ); if ( array_intersect( $allowed_roles, $user->roles ) ) { return 1; } // Otherwise, return the original approval status. return $approved; } add_filter( 'pre_comment_approved' , 'prefix_auto_approve_comments_by_role' , '99', 2 );
Thus my question to the support community here as I cannot find any other appropriate filter in Akismet itself, or any related documentation:
How to completely bypass Akismet scanning for certain users?
The filter name, if any, is enough for me to proceed.
Thanks
- This topic was modified 1 year, 6 months ago by Beda .