• Hi there,

    I love the form, and i’ve been trying to alter it to fit my site logic.

    I need to obtain the post id from within your compose_and_send_mail function so i can get some post_meta values.

    How would i go about getting the post id from within that function?

    Thanks in advance.

    Dejan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi.

    I also try to get and use the post_id of the post from where I used the form in my functions.php.
    Everything I tried failed… 🙁

    Did you found a solution?

    Thanks.

    I found a solution that works for me:

    function mycf7_before_send_mail($cf7) {
    // Execute this Code only for Form-ID 3!
    if ( 3 == $cf7->id ) {
    $my_postid = wpcf7_special_mail_tag_for_post_data( $output, ‘_post_id’ ) ;
    
    }
    }
    add_action( ‘wpcf7_before_send_mail’, ‘mycf7_before_send_mail’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Contact Form 7] Get Post ID from within compose_and_send function’ is closed to new replies.