Meta Box
Support › MB Frontend Submission › Use rwmb_frontend_after_save_postResolved
Hi ! I'm trying to add post meta after form is submitted with frontend form. I just can't find how to retrieve $post_id to use it in my function. Can you point me in the right direction and give me an example with add_action ? Thanks ! Cedric.
Hi,
Please take a look at my sample code
add_action( 'rwmb_frontend_after_save_post', function( $object_post ) { add_post_meta( $object_post->post_id, 'test_post_meta', 'Test Post Meta Value' ); } );
You can use 4 properties of the MB Frontend Post class $post_type $post_id $fields $config.
$post_type
$post_id
$fields
$config
For more information, please follow the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#post-actions
Thank you very much ! 🙂