Filter
rpress_should_anonymize_payment
On this page
Filters whether a payment may be anonymized by a privacy erasure request.
Runs in _rpress_anonymize_payment() after the payment has been loaded. The value is an array with 'should_anonymize' (true by default) and 'message'. If 'should_anonymize' is empty, the payment is left untouched and the message is returned as the reason.
Available since RestroPress 2.9.2.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$result | array | Array with 'should_anonymize' (bool) and 'message' (string). |
$payment | RPRESS_Payment | The payment being anonymized. |
Return value#
array. Array with 'should_anonymize' and 'message'.
Example#
add_filter( 'rpress_should_anonymize_payment', 'my_keep_recent_payments', 10, 2 );
function my_keep_recent_payments( $result, $payment ) {
if ( strtotime( $payment->date ) > strtotime( '-30 days' ) ) {
$result['should_anonymize'] = false;
$result['message'] = __( 'The order is too recent to anonymize.', 'my-plugin' );
}
return $result;
}
Source#
Applied in:
includes/privacy-functions.php(line 321), in_rpress_anonymize_payment()
See also#
Was this page helpful?
