Custom Fields
Re-Envisioned
Support MB Frontend Submission Use rwmb_frontend_after_save_post

  • Creator
    Topic
  • #19559
    Resolved netalys
    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #19562
    Long 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
    netalys
    Participant

    Thank you very much ! 🙂

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