Skip to content
Docs
Get RestroPress

Filter

rpress_discount_row_actions

Updated
On this page

Filters the row action links under each discount name in the Discount Codes table.

Applied when the Name column is rendered. The array holds HTML links keyed edit, deactivate or activate (depending on the discount status) and delete. Add, remove or replace entries to change what is shown by WP_List_Table::row_actions().

Parameters#

ParameterTypeDescription
$row_actionsarrayRow action HTML links keyed by slug.
$discountWP_PostThe discount post for the current row.

Return value#

array. The row action links to display.

Example#

function my_discount_row_actions( $row_actions, $discount ) {
	$url = add_query_arg( array( 'rpress-action' => 'my_duplicate_discount', 'discount' => $discount->ID ) );
	$row_actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $url, 'my_duplicate_discount' ) ) . '">' . esc_html__( 'Duplicate', 'my-plugin' ) . '</a>';
	return $row_actions;
}
add_filter( 'rpress_discount_row_actions', 'my_discount_row_actions', 10, 2 );

Notes#

A custom link that points at an rpress-action is dispatched to the matching rpress_{action} hook on admin_init.

Source#

Applied in:

  • includes/admin/discounts/class-discount-codes-table.php (line 222), in RPRESS_Discount_Codes_Table::column_name()
Was this page helpful?