Use rwmb_frontend_after_save_post

Support MB Frontend Submission Use rwmb_frontend_after_save_postResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19559
    netalysnetalys
    Participant

    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.

    #19562
    Long NguyenLong Nguyen
    Moderator

    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.

    For more information, please follow the documentation
    https://docs.metabox.io/extensions/mb-frontend-submission/#post-actions

    #19565
    netalysnetalys
    Participant

    Thank you very much ! 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.