Skip to content
Docs
Get RestroPress

Action

rpress_post_update_discount_status

Updated
On this page

Fires after the status of a discount is updated.

Fires in RPRESS_Discount::update_status() after wp_update_post() has run, before the method returns whether the update succeeded. The post status argument is the object's property, not re-read from the database.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$discount_idintThe discount ID.
$new_statusstringThe new status.
$post_statusstringThe discount object's current post status property.

Example#

function my_post_update_discount_status( $discount_id, $new_status, $post_status ) {
	if ( 'inactive' === $new_status ) {
		delete_transient( 'my_active_discounts' );
	}
}
add_action( 'rpress_post_update_discount_status', 'my_post_update_discount_status', 10, 3 );

Source#

Fired from:

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

See also#

Was this page helpful?