Skip to content
Docs
Get RestroPress

Filter

rpress_cc_card_types

Updated
On this page

Filters the card type definitions used to detect a card type from its number.

Runs in rpress_detect_cc_type() before the number is matched against each definition. Each item is an array with name, pattern (a regular expression matched against the number) and valid_length (an array of allowed lengths). If a non-array is returned, detection returns false.

Parameters#

ParameterTypeDescription
$card_typesarray[]Card type definitions with the keys name, pattern and valid_length.

Return value#

array[]. The card type definitions to match against.

Example#

function my_cc_card_types( $card_types ) {
	$card_types[] = array(
		'name'         => 'unionpay',
		'pattern'      => '/^62/',
		'valid_length' => array( 16, 17, 18, 19 ),
	);
	return $card_types;
}
add_filter( 'rpress_cc_card_types', 'my_cc_card_types', 10, 1 );

Source#

Applied in:

  • includes/checkout/functions.php (line 492), in rpress_detect_cc_type()

See also#

Was this page helpful?