Action
rpress_fooditem_post_create
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#
| Parameter | Type | Description |
|---|---|---|
$id | int|WP_Error | Post ID of the created menu item, or a WP_Error on failure. |
$args | array | Post 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), inRPRESS_Fooditem::create()
See also#
Was this page helpful?
