Skip to content
Docs
Get RestroPress

Action

rpress_post_insert_{$type}

Updated
On this page

Fires after a row is inserted into a RestroPress custom table.

Fires in RPRESS_DB::insert() after the row has been written with $wpdb->insert(). In core the only type used is customer, so the concrete hook is rpress_post_insert_customer. The data has been reduced to known columns by then.

Parameters#

ParameterTypeDescription
$insert_idintThe ID of the inserted row ($wpdb->insert_id).
$dataarrayThe row data that was inserted, limited to known columns.

Example#

function my_post_insert_customer( $insert_id, $data ) {
	update_option( 'my_last_customer_row', (int) $insert_id );
}
add_action( 'rpress_post_insert_customer', 'my_post_insert_customer', 10, 2 );

Notes#

The suffix is the type string passed to RPRESS_DB::insert(). The static hooks rpress_post_insert_discount and rpress_post_insert_log are unrelated.

Source#

Fired from:

  • includes/class-rpress-db.php (line 123), in RPRESS_DB::insert()

See also#

Was this page helpful?