説明

について wpforms_math_captcha フィルタの設定プロパティは カスタムキャプチャ フィールドを使用します。

パラメータ

設定
(必須)最小整数 ・ 最大整数 ・ 演算子。

ソース

wpforms-captcha/src/Plugin.php

詳細情報

について wpforms_math_captcha フィルタは配列に適用され、 最小値と最大値、そしてそれらの値で使われる計算の種類 (加算、乗算など) を設定します。これは、カスタムキャプチャフィールドで許可される整数の範囲と演算子を変更するために使用できます。

/**
 * 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 );

参考記事

カスタムCaptchaフィールドのCaptcha Mathを変更する