Action
rpress_pre_insert_{$type}
On this page
Fires before a row is inserted into a RestroPress custom table.
Fires in RPRESS_DB::insert() after the column defaults are merged into the data and before the data is filtered to known columns. In core the only type used is customer, so the concrete hook is rpress_pre_insert_customer, fired when a new customer row is created.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$data | array | Row data merged with the column defaults. |
Example#
function my_pre_insert_customer( $data ) {
error_log( 'Inserting customer ' . ( isset( $data['email'] ) ? $data['email'] : '' ) );
}
add_action( 'rpress_pre_insert_customer', 'my_pre_insert_customer' );
Notes#
The suffix is the type string passed to RPRESS_DB::insert(). The static hooks rpress_pre_insert_discount and rpress_pre_insert_log are unrelated.
Source#
Fired from:
includes/class-rpress-db.php(line 111), inRPRESS_DB::insert()
See also#
Was this page helpful?
