Skip to content
Docs
Get RestroPress

Action

rpress_fooditem_pre_create

Updated
On this page

Fires before a menu item is created through RPRESS_Fooditem::create().

Runs immediately before wp_insert_post() is called with the merged arguments. The defaults are post_type fooditem, post_status draft and the title New Product. This only fires when a menu item is created through the RPRESS_Fooditem class, not when one is saved from the admin editor.

Parameters#

ParameterTypeDescription
$argsarrayPost arguments that will be passed to wp_insert_post().

Example#

function my_before_fooditem_create( $args ) {
	error_log( 'Creating menu item: ' . $args['post_title'] );
}
add_action( 'rpress_fooditem_pre_create', 'my_before_fooditem_create' );

Source#

Fired from:

  • includes/class-rpress-fooditem.php (line 190), in RPRESS_Fooditem::create()

See also#

Was this page helpful?