Skip to content
Docs
Get RestroPress

Filter

rpress_is_order_trashable

Updated
On this page

Filters whether an order can be trashed.

Runs at the end of rpress_is_order_trashable() with the computed result: true when the order exists and its payment status is not in the non-trashable list. The row actions and the trash handler use it to decide whether to offer or allow trashing.

Parameters#

ParameterTypeDescription
$is_trashableboolWhether the order can be trashed.
$paymentRPRESS_PaymentThe payment object for the order.

Return value#

bool. True if the order can be trashed.

Example#

function my_is_order_trashable( $is_trashable, $payment ) {
	if ( 'completed' === rpress_get_order_status( $payment->ID ) ) {
		return false;
	}
	return $is_trashable;
}
add_filter( 'rpress_is_order_trashable', 'my_is_order_trashable', 10, 2 );

Notes#

The result is cast to bool. It is not called when the payment cannot be loaded.

Source#

Applied in:

  • includes/admin/orders/actions.php (line 278), in rpress_is_order_trashable()

See also#

Was this page helpful?