Skip to content
Docs
Get RestroPress

Action

rpress_edit_discount_form_top

Updated
On this page

Fires at the top of the Edit Discount form, before the form table.

Runs right after the opening form tag of the Edit Discount screen. Use it to print hidden inputs or notices tied to the discount being edited.

Parameters#

ParameterTypeDescription
$discount_idintThe discount ID being edited.
$discountRPRESS_Discount|falseThe discount object loaded with rpress_get_discount(); false when the discount was not found.

Example#

function my_edit_discount_form_top( $discount_id, $discount ) {
	echo '<input type="hidden" name="my_discount_ref" value="' . esc_attr( $discount_id ) . '" />';
}
add_action( 'rpress_edit_discount_form_top', 'my_edit_discount_form_top', 10, 2 );

Notes#

Printing a field does not save it. Save submitted values from rpress_post_update_discount.

Source#

Fired from:

  • includes/admin/discounts/edit-discount.php (line 36)

See also#

Was this page helpful?