Skip to content
Docs
Get RestroPress

Action

rpress_fooditem_post_create

Updated
On this page

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

Runs right after wp_insert_post() and before the object is populated. The ID comes straight from wp_insert_post() called with error returning enabled, so it can be a WP_Error if the insert failed. Check it before use.

Parameters#

ParameterTypeDescription
$idint|WP_ErrorPost ID of the created menu item, or a WP_Error on failure.
$argsarrayPost arguments used for creation.

Example#

function my_after_fooditem_create( $id, $args ) {
	if ( is_wp_error( $id ) ) {
		return;
	}
	update_post_meta( $id, '_my_created_via', 'importer' );
}
add_action( 'rpress_fooditem_post_create', 'my_after_fooditem_create', 10, 2 );

Source#

Fired from:

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

See also#

Was this page helpful?