<html lang="ja-jp" dir="ltr"><head></head><body>### [wpforms_math_captcha](https://wpforms.com/developers/wpforms_math_captcha/)

**公開日:** 2020年2月19日
**著者:** エディトリアルチーム

**抜粋:** wpforms_math_captcha フィルターの設定プロパティは、WPForms の **カスタムキャプチャ** フィールドに適用されます。


**コンテンツ:**

## 説明

`wpforms_math_captcha` フィルターの設定プロパティは、WPForms の **カスタムキャプチャ** フィールドに適用されます。

## パラメータ

$settings*(配列) (必須)* 使用される最小整数、最大整数、および演算子。## ソース

`wpforms-captcha/src/Plugin.php`

## 詳細情報

`wpforms_math_captcha` フィルターは、最小値と最大値を設定する配列、およびそれらの値で使用される計算の種類（加算、乗算など）に適用されます。カスタムキャプチャフィールドで使用できる整数範囲と演算子を変更するために使用できます。

## 例

```

/**
 * カスタムキャプチャアドオンに適用される設定プロパティをフィルター処理します。
 *
 * @link   https://wpforms.com/developers/wpforms_math_captcha/
 *
 * @param  array $settings 使用される最小整数、最大整数、および演算子。
 * @return array
 */

function wpf_dev_math_captcha_settings( $settings ) {
     
    /* デフォルト設定
        array(
            'min' =&gt; 1,
            'max' =&gt; 15,
            'cal' =&gt; array( '+', '*', '-' ),
        );
     */
 
    // 簡単な計算のために加算のみを使用
    // 最小数 1 を使用
    // 最大数 10 を使用
    $settings[ 'cal' ] = [ '+' ];
	$settings[ 'min' ] = [ '1' ];
	$settings[ 'max' ] = [ '10' ];
 
    return $settings;
}

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

```

## 参考記事

[カスタムキャプチャフィールドのキャプチャ計算を変更する](https://wpforms.com/developers/change-the-captcha-math-for-the-custom-captcha-addon/ "カスタムキャプチャフィールドのキャプチャ計算を変更する")

**カテゴリ:** フィルターフック

**タグ:** カスタムキャプチャアドオン, PHP

---</body></html>