gform_moderation_field_types_to_analyze

Description

The gform_moderation_field_types_to_analyze filter can be used to set the field types which are used in toxicity analysis by the Moderation Add-On.

Usage

add_filter( 'gform_moderation_field_types_to_analyze', 'your_function_name', 10, 2 );

Parameters

ParameterTypeDescription
$field_types_to_analyzearrayThe types of fields to be analyzed for toxicity.
$formarrayThe form being processed.

The $field_types_to_analyze parameter defaults to:

array(
	'email',
	'name',
	'text',
	'textarea',
	'website',
	'address',
	'post_content',
	'post_custom_field',
	'post_excerpt',
	'post_title'
)

Examples

Add additional field types for toxicity.

add_filter( 'gform_moderation_field_types_to_analyze', 'add_custom_field_types_for_moderation', 10, 2 );
function add_custom_field_types_for_moderation( $field_types_to_analyze, $form ) {
    $field_types_to_analyze[] = 'phone';
    $field_types_to_analyze[] = 'number';
    return $field_types_to_analyze;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in class-gf-moderation.php.

Since

This filter was added in Gravity Forms reCAPTCHA 1.0.