Filter
rpress_insert_payment_args
On this page
Filters the arguments passed to wp_insert_post when a payment is created.
Applied in RPRESS_Payment::insert_payment. The array contains post_title, post_status, post_type (rpress_payment), post_date, post_date_gmt and post_parent. The second argument is a summary of the payment data (price, date, email, purchase key, currency, menu items, user info, cart details, status and fees) for reference.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$args | array | wp_insert_post arguments. |
$payment_data | array | Summary of the payment being created. |
Return value#
array. The arguments to pass to wp_insert_post.
Example#
function my_insert_payment_args( $args, $payment_data ) {
if ( ! empty( $payment_data['user_info']['id'] ) ) {
$args['post_author'] = (int) $payment_data['user_info']['id'];
}
return $args;
}
add_filter( 'rpress_insert_payment_args', 'my_insert_payment_args', 10, 2 );
Source#
Applied in:
includes/payments/class-rpress-payment.php(line 521), inRPRESS_Payment::insert_payment()
See also#
Was this page helpful?
