Skip to content
Docs
Get RestroPress

Action

rpress_discount_form_before_code

Updated
On this page

Fires on the Add Discount form before the Code row.

Runs while the Add New Discount form is being printed, inside the form table, before the Code row. Output complete table rows (tr elements) so the markup stays valid. The action receives no arguments.

Example#

function my_discount_field_row() {
	?>
	<tr>
		<th scope="row"><label for="my-discount-note"><?php esc_html_e( 'Internal note', 'my-plugin' ); ?></label></th>
		<td><input type="text" id="my-discount-note" name="my_discount_note" class="regular-text" /></td>
	</tr>
	<?php
}
add_action( 'rpress_discount_form_before_code', 'my_discount_field_row' );

Notes#

Printing a field does not save it. Save submitted values from rpress_post_insert_discount (add) or rpress_post_update_discount (edit). The hook name has no add_ prefix, unlike its siblings.

Source#

Fired from:

  • includes/admin/discounts/add-discount.php (line 35)

See also#

Was this page helpful?