Skip to content
Docs
Get RestroPress

Action

rest_after_insert_{$post_type}

Updated
On this page

Fires after an order post has been inserted and its data fully saved through the REST API.

Mirrors the WordPress core rest_after_insert_{$post_type} action for the orders controller, giving rest_after_insert_rpress_payment. It runs at the end of create_item, just before wp_after_insert_post() and the response is prepared with status 201.

Parameters#

ParameterTypeDescription
$postWP_PostThe inserted order post.
$requestWP_REST_RequestThe request object.
$creatingboolAlways true.

Example#

function my_after_rest_order_saved( $post, $request, $creating ) {
	error_log( sprintf( 'Order %d created via REST', $post->ID ) );
}
add_action( 'rest_after_insert_rpress_payment', 'my_after_rest_order_saved', 10, 3 );

Notes#

Fired from create_item only.

Source#

Fired from:

  • includes/rest-api/Controllers/Version1/class-rp-rest-orders-v1-controller.php (line 731), in RP_REST_Orders_V1_Controller::create_item()
Was this page helpful?