Action
rest_after_insert_{$post_type}
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#
| Parameter | Type | Description |
|---|---|---|
$post | WP_Post | The inserted order post. |
$request | WP_REST_Request | The request object. |
$creating | bool | Always 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), inRP_REST_Orders_V1_Controller::create_item()
Was this page helpful?
