Filter hook 'akismet_comment_nonce'

in WP Core File wp-content/plugins/akismet/class.akismet.php at line 1217

View Source

akismet_comment_nonce

Filter Hook
Description
To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag and return any string value that is not 'true' or '' (empty string). Don't return boolean false, because that implies that the 'akismet_comment_nonce' option has not been set and that Akismet should just choose the default behavior for that situation.

Hook Information

File Location wp-content/plugins/akismet/class.akismet.php View on GitHub
Hook Type Filter
Line Number 1217

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into akismet_comment_nonce
add_filter('akismet_comment_nonce', 'my_custom_filter');

function my_custom_filter() {
    // Your custom filtering logic here
    return 'modified_value';
}

Source Code Context

wp-content/plugins/akismet/class.akismet.php:1217 - How this hook is used in WordPress core
<?php
1212  
1213  		if ( ! self::get_api_key() ) {
1214  			return;
1215  		}
1216  
1217  		$akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
1218  
1219  		if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) {
1220  			echo '<p style="display: none;">';
1221  			wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', false );
1222  			echo '</p>';

PHP Documentation

<?php
/**
		 * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag
		 * and return any string value that is not 'true' or '' (empty string).
		 *
		 * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option
		 * has not been set and that Akismet should just choose the default behavior for that
		 * situation.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 0
  • File: wp-content/plugins/akismet/class.akismet.php
Related Hooks

Related hooks will be displayed here in future updates.