Action
rest_insert_{$post_type}
On this page
Fires after an order post has been inserted through the REST API.
Mirrors the WordPress core rest_insert_{$post_type} action for the orders controller, so the hook name is rest_insert_rpress_payment. It runs in create_item after the post is created and before sticky handling and meta updates.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$post | WP_Post | The inserted order post. |
$request | WP_REST_Request | The request object. |
$creating | bool | Always true, since the hook is only fired when an order is created. |
Example#
function my_after_rest_order_insert( $post, $request, $creating ) {
update_post_meta( $post->ID, 'my_created_via_rest', 1 );
}
add_action( 'rest_insert_rpress_payment', 'my_after_rest_order_insert', 10, 3 );
Notes#
Fired from create_item only; there is no matching call on update.
Source#
Fired from:
includes/rest-api/Controllers/Version1/class-rp-rest-orders-v1-controller.php(line 680), inRP_REST_Orders_V1_Controller::create_item()
Was this page helpful?
