Skip to content
Docs
Get RestroPress

Filter

rpress_cc_is_valid_format

Updated
On this page

Filters the final result of the card number format validation.

Runs at the end of rpress_validate_card_number_format(), after the Luhn check and the card type lookup. The value is true only if the number passed both. Return false to reject a number the plugin accepted, or true to accept one it rejected.

Parameters#

ParameterTypeDescription
$is_valid_formatboolWhether the number passed the Luhn check and matched a known card type.
$numberstringThe card number being validated.

Return value#

bool. True if the card number format is valid.

Example#

function my_cc_is_valid_format( $is_valid_format, $number ) {
	return $is_valid_format && strlen( $number ) >= 13;
}
add_filter( 'rpress_cc_is_valid_format', 'my_cc_is_valid_format', 10, 2 );

Source#

Applied in:

  • includes/checkout/functions.php (line 391), in rpress_validate_card_number_format()

See also#

Was this page helpful?