• Hi,

    I read your docs about adding custom form tag.
    https://contactform7.com/2015/01/10/adding-a-custom-form-tag/

    However, it not works.

    I have custom post type of business.
    On every page there is a contact form.

    I want to pass the title of the business.
    I am using [_post_title] but it not always work – and this tag not exported to csv by flamingo.

    So, I want to get the custom post type’ title – and get it as [hidden] tag.
    Because I don’t need to show it to user.

    I made this code:

    add_action( 'wpcf7_init', 'custom_add_form_tag' );
     
    function custom_add_form_tag() {
      wpcf7_add_form_tag( 'posttitle', 'custom_form_tag_handler' );
    }
     
    function custom_form_tag_handler( $tag ) {
      return the_title();
    }

    This doesn’t work.

    Can you help please?

  • The topic ‘adding custom form-tag’ is closed to new replies.