Skip to content
Docs
Get RestroPress

Action

rpress_post_insert_discount

Updated
On this page

Fires after a discount is added to the database.

Fires in RPRESS_Discount::add() after the post and its meta have been created, before the discount object is set up from the new post.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$metaarrayDiscount meta that was stored.
$discount_idintThe ID of the new discount.

Example#

function my_post_insert_discount( $meta, $discount_id ) {
	update_post_meta( $discount_id, '_my_created_by', get_current_user_id() );
}
add_action( 'rpress_post_insert_discount', 'my_post_insert_discount', 10, 2 );

Source#

Fired from:

  • includes/class-rpress-discount.php (line 1216), in RPRESS_Discount::add()

See also#

Was this page helpful?