Description

The wpforms_math_captcha filters setting properties are applied to the Custom Captcha field in WPForms.

Parameters

$settings
(array) (Required) Minimum integer, maximum integer, and operators that will be used.

Source

wpforms-captcha/src/Plugin.php

More Information

The wpforms_math_captcha filter is applied to an array that sets minimum and maximum numbers, as well as the type of calculations used with those values (addition, multiplication, etc). It can be used to change the integer range and operators allowed in a custom captcha field.

Example

/**
 * Filters setting properties applied to the Custom Captcha addon.
 *
 * @link   https://wpforms.com/developers/wpforms_math_captcha/
 *
 * @param  array $settings Minimum integer, maximum integer, and operators that will be used.
 * @return array
 */

function wpf_dev_math_captcha_settings( $settings ) {
     
    /* Default settings
        array(
            'min' => 1,
            'max' => 15,
            'cal' => array( '+', '*', '-' ),
        );
     */
 
    // Use addition only for easier math
    // Use the minimum number of 1
    // Use the maximum number of 10
    $settings[ 'cal' ] = [ '+' ];
	$settings[ 'min' ] = [ '1' ];
	$settings[ 'max' ] = [ '10' ];
 
    return $settings;
}

add_filter( 'wpforms_math_captcha', 'wpf_dev_math_captcha_settings', 30, 1 );

Reference Articles

Change the Captcha Math for the Custom Captcha Field