Skip to content
Docs
Get RestroPress

Action

rest_insert_{$post_type}

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

ParameterTypeDescription
$postWP_PostThe inserted order post.
$requestWP_REST_RequestThe request object.
$creatingboolAlways 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), in RP_REST_Orders_V1_Controller::create_item()
Was this page helpful?