Skip to content
Docs
Get RestroPress

Filter

rpress_get_payment_meta_{$meta_key}

Updated
On this page

Filters a payment meta value read with RPRESS_Payment::get_meta, per meta key.

Applied in RPRESS_Payment::get_meta right after the value is read, and after the backwards-compatibility fixes for the main payment meta array. The hook name ends with the requested meta key. With the default key it is rpress_get_payment_meta__rpress_payment_meta (two underscores).

Parameters#

ParameterTypeDescription
$metamixedThe meta value.
$payment_idintID of the payment.

Return value#

mixed. The meta value to return.

Example#

function my_payment_meta_for_key( $meta, $payment_id ) {
	if ( is_array( $meta ) && ! isset( $meta['my_source'] ) ) {
		$meta['my_source'] = 'unknown';
	}
	return $meta;
}
add_filter( 'rpress_get_payment_meta__rpress_payment_meta', 'my_payment_meta_for_key', 10, 2 );

Notes#

Followed by the generic rpress_get_payment_meta filter, which also receives the meta key.

Source#

Applied in:

  • includes/payments/class-rpress-payment.php (line 1532), in RPRESS_Payment::get_meta()

See also#

Was this page helpful?