Skip to content
Docs
Get RestroPress

Filter

rpress_insert_discount_args

Updated
On this page

Filters the post arguments used to create a discount post.

Runs in RPRESS_Discount::insert_discount() just before wp_insert_post() creates the blank rpress_discount post. The array holds post_title, post_status, post_type, post_date and post_date_gmt. The discount meta is written afterwards.

Parameters#

ParameterTypeDescription
$argsarrayArguments for wp_insert_post().
$discount_dataarrayThe discount data that will be saved as meta after the post is created.

Return value#

array. Arguments passed to wp_insert_post().

Example#

function my_insert_discount_args( $args, $discount_data ) {
	$args['post_status'] = 'active';
	return $args;
}
add_filter( 'rpress_insert_discount_args', 'my_insert_discount_args', 10, 2 );

Source#

Applied in:

  • includes/class-rpress-discount.php (line 1080), in RPRESS_Discount::insert_discount()
Was this page helpful?