Skip to content
Docs
Get RestroPress

Filter

rpress_insert_payment_args

Updated
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#

ParameterTypeDescription
$argsarraywp_insert_post arguments.
$payment_dataarraySummary 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), in RPRESS_Payment::insert_payment()

See also#

Was this page helpful?