Show a Custom Akismet Privacy Notice Under Comments
Turns on the Akismet privacy notice below the comment form and replaces it with your own wording and link to your privacy policy, which many privacy laws expect.
Opens WPIDE on
Code
add_filter( 'akismet_comment_form_privacy_notice', function () {
return 'display';
} );
add_filter( 'akismet_comment_form_privacy_notice_markup', function () {
$policy = get_privacy_policy_url();
return '<p class="akismet_comment_form_privacy_notice" style="font-size:.85em">'
. esc_html__( 'Comments are checked for spam by Akismet.' ) . ' '
. ( $policy ? '<a href="' . esc_url( $policy ) . '">' . esc_html__( 'How we handle your data' ) . '</a>' : '<a href="https://akismet.com/privacy/" rel="nofollow noopener">' . esc_html__( 'How Akismet handles your data' ) . '</a>' )
. '</p>';
} );
Notes
Uses your Privacy Policy page from Settings > Privacy when one is set.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.