Skip to content
Docs
Get RestroPress

Filter

rpress_use_after_payment_actions

Updated
On this page

Filters whether the after-payment actions are deferred to a scheduled WP-Cron event.

By default (true) rpress_schedule_after_payment_action schedules a single event that later fires rpress_after_payment_actions. Return false to run the actions immediately inside the request that completes the payment, which is useful on sites where WP-Cron does not run.

Parameters#

ParameterTypeDescription
$use_cronboolTrue to schedule the actions, false to run them immediately.
$payment_idintID of the payment.

Return value#

bool. Whether to use WP-Cron.

Example#

function my_run_after_payment_now( $use_cron, $payment_id ) {
	return false;
}
add_filter( 'rpress_use_after_payment_actions', 'my_run_after_payment_now', 10, 2 );

Notes#

Evaluated in two places: when the purchase is completed, to decide whether to run the actions at once, and again when scheduling the event. Use a callback whose result does not change between the two calls.

Source#

Applied in:

  • includes/payments/actions.php (line 130), in rpress_complete_purchase()
  • includes/payments/actions.php (line 159), in rpress_schedule_after_payment_action()

See also#

Was this page helpful?