Skip to content
Docs
Get RestroPress

Filter

rpress_is_gateway_active

Updated
On this page

Filters whether a payment gateway is active.

Runs in rpress_is_gateway_active after the gateway ID is looked up in the enabled gateways list. Return true or false to override the result for a specific gateway.

Parameters#

ParameterTypeDescription
$retboolTrue when the gateway is in the enabled list.
$gatewaystringGateway ID being checked.
$gatewaysarrayEnabled gateways keyed by ID.

Return value#

bool. Whether the gateway is active.

Example#

function my_is_gateway_active( $ret, $gateway, $gateways ) {
	if ( 'cash_on_delivery' === $gateway && ! is_user_logged_in() ) {
		return false;
	}
	return $ret;
}
add_filter( 'rpress_is_gateway_active', 'my_is_gateway_active', 10, 3 );

Source#

Applied in:

  • includes/gateways/functions.php (line 84), in rpress_is_gateway_active()

See also#

Was this page helpful?