bookmark_bordergform_akismet_fields

Description

Use this filter to specify the fields that are sent to the Akismet anti-spam service.

Usage

add_filter( 'gform_akismet_fields', 'set_akismet_fields', 10, 3 );

You can also target a specific form by adding the form id after the hook name.

<?php
add_filter( 'gform_akismet_fields_6', 'set_akismet_fields', 10, 3 );
&#91;/php&#93;

<h2>Parameters</h2>

<ul>
<li><strong>$akismet_fields</strong> array

The akismet fields to be filtered, in the following format:

array(
        'comment_type' => 'gravity_form',
        'comment_author' => 'Author name',
        'comment_author_email' => 'email@test.com',
        'comment_author_url' => 'http://www.someurl.com',
        'comment_content' => 'Some text',
        'contact_form_subject' => 'Contact Us',
        'comment_author_ip' => '127.0.0.1',
        'permalink' => 'http://www.someurl.com/contactus',
        'user_ip' => '127.0.0.1',
        'user_agent' => 'user agent string',
        'referrer' => 'http://www.referrer.com',
        'blog' => 'http://www.someurl.com',
    );
    

  • $form

    Current Form object

  • $entry Entry Object

    Current Entry object

  • Examples

    This example overrides the value in the “comment_content” Akismet field so that is is pulled from another field. (field ID: 1).

    add_action( 'gform_akismet_fields', 'set_akismet_fields', 10, 3 );
    function set_akismet_fields( $akismet_fields, $form, $entry ) {
        $akismet_fields['comment_content'] = rgar( $entry, '1' );
    
        return $akismet_fields;
    }
    

    Placement

    This code should be placed in the functions.php file of your active theme.

    Source Code

    This filter is located in GFCommon::get_akismet_fields() in common.php