functions.php
add_filter(‘wpcf7_validate_textarea’, ‘wpcf7_validation_textarea_hiragana’, 10, 2);
add_filter(‘wpcf7_validate_textarea*’, ‘wpcf7_validation_textarea_hiragana’, 10, 2);
function wpcf7_validation_textarea_hiragana($result, $tag)
{
$name = $tag[‘name’];
$value = (isset($_POST[$name])) ? (string) $_POST[$name] : ”;if ($value !== '' && !preg_match('/[ぁ-ん]/u', $value)) { $result['valid'] = false; $result['reason'] = array($name => 'エラー / この内容は送信できません。'); } return $result;
}