Filter
rpress_valiate_card_format_pre_type
On this page
Filters the card number validity after the Luhn check and before card type matching.
Runs in rpress_validate_card_number_format() right after the Luhn check. If the value is true, the number then has to match a known card type; if false, validation fails. Use it to add extra checks on the number before type detection.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$is_valid_format | bool | Whether the number passed the Luhn check. |
$number | string | The card number being validated. |
Return value#
bool. Whether the number should continue to card type matching.
Example#
function my_card_format_pre_type( $is_valid_format, $number ) {
if ( $is_valid_format && 1 === count( array_unique( str_split( $number ) ) ) ) {
return false;
}
return $is_valid_format;
}
add_filter( 'rpress_valiate_card_format_pre_type', 'my_card_format_pre_type', 10, 2 );
Notes#
The hook name is spelled "valiate" in the source and must be used exactly as written.
Source#
Applied in:
includes/checkout/functions.php(line 391), inrpress_validate_card_number_format()
See also#
Was this page helpful?
