Post My CF7 Form
by Aurovrata V. 4.8 (48 reviews)

Post My CF7 Form

This plugin enables the mapping of your CF7 forms to custom posts, including featured images, files, meta-fields and taxonomies

Tested up to WP 6.4 (Current: 6.9)
v6.1.0 Current Version v6.1.0
Updated 1 year ago Last Update on 02 May, 2024
Synced 10 hours ago Last Synced on
Rank
#4,568
-1 this week
Active Installs
2K+
-30.9%
KW Avg Position
123.5
+0.5 better
Downloads
94.4K
+7 today
Support Resolved
0%
No change
Rating
96%
Review 4.8 out of 5
4.8 (48 reviews)

Next Milestone 3K

Total Progress 84.4%
2K+ 3K+
150
Ranks to Climb
-
Growth Needed
8,000,000
Active Installs
Pro

Unlock Exact Install Count

See the precise estimated active installs for this plugin, calculated from real-time ranking data.

  • Exact install estimates within tiers
  • Track install growth over time
  • Milestone progress predictions
Upgrade to Pro
Need 156 more installs to reach 3K+

Rank Changes

4,337 4,452 4,567 4,681 4,796 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
4,550 4,556 4,562 4,567 4,573 05-01-2026 06-01-2026 07-01-2026 08-01-2026 09-01-2026 10-01-2026 11-01-2026 12-01-2026 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
4,548 4,554 4,561 4,567 4,573 21-12-2025 22-12-2025 23-12-2025 24-12-2025 25-12-2025 26-12-2025 27-12-2025 28-12-2025 29-12-2025 30-12-2025 31-12-2025 01-01-2026 02-01-2026 03-01-2026 04-01-2026 05-01-2026 06-01-2026 07-01-2026 08-01-2026 09-01-2026 10-01-2026 11-01-2026 12-01-2026 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
4,540 4,548 4,557 4,565 4,573 22-10-2025 23-10-2025 24-10-2025 25-10-2025 26-10-2025 27-10-2025 28-10-2025 29-10-2025 30-10-2025 31-10-2025 01-11-2025 02-11-2025 03-11-2025 04-11-2025 05-11-2025 06-11-2025 07-11-2025 08-11-2025 09-11-2025 10-11-2025 11-11-2025 12-11-2025 13-11-2025 14-11-2025 15-11-2025 16-11-2025 17-11-2025 18-11-2025 19-11-2025 20-11-2025 21-11-2025 22-11-2025 23-11-2025 24-11-2025 25-11-2025 26-11-2025 27-11-2025 28-11-2025 29-11-2025 30-11-2025 01-12-2025 02-12-2025 03-12-2025 04-12-2025 05-12-2025 06-12-2025 07-12-2025 08-12-2025 09-12-2025 10-12-2025 11-12-2025 12-12-2025 13-12-2025 14-12-2025 15-12-2025 16-12-2025 17-12-2025 18-12-2025 19-12-2025 20-12-2025 21-12-2025 22-12-2025 23-12-2025 24-12-2025 25-12-2025 26-12-2025 27-12-2025 28-12-2025 29-12-2025 30-12-2025 31-12-2025 01-01-2026 02-01-2026 03-01-2026 04-01-2026 05-01-2026 06-01-2026 07-01-2026 08-01-2026 09-01-2026 10-01-2026 11-01-2026 12-01-2026 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
Current #4,568
Change
Best #

Upgrade to Pro

Unlock 30-day and 90-day rank history charts with a Pro subscription.

Upgrade Now

Active Installs Growth

Active Installs 0,000,000+
Growth +0.0%
Peak 0,000,000

Downloads Growth

0 10 20 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
0 10 20 05-01-2026 06-01-2026 07-01-2026 08-01-2026 09-01-2026 10-01-2026 11-01-2026 12-01-2026 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
0 10 20 21-12-2025 22-12-2025 23-12-2025 24-12-2025 25-12-2025 26-12-2025 27-12-2025 28-12-2025 29-12-2025 30-12-2025 31-12-2025 01-01-2026 02-01-2026 03-01-2026 04-01-2026 05-01-2026 06-01-2026 07-01-2026 08-01-2026 09-01-2026 10-01-2026 11-01-2026 12-01-2026 13-01-2026 14-01-2026 15-01-2026 16-01-2026 17-01-2026 18-01-2026 19-01-2026 20-01-2026
0 10 20 30 40 50 60 22-10-2025 25-10-2025 28-10-2025 31-10-2025 03-11-2025 06-11-2025 09-11-2025 12-11-2025 15-11-2025 18-11-2025 21-11-2025 24-11-2025 27-11-2025 30-11-2025 03-12-2025 06-12-2025 09-12-2025 12-12-2025 15-12-2025 18-12-2025 21-12-2025 24-12-2025 27-12-2025 30-12-2025 02-01-2026 05-01-2026 08-01-2026 11-01-2026 14-01-2026 17-01-2026 20-01-2026
0 10 20 30 40 50 60 20-01-2025 01-02-2025 13-02-2025 25-02-2025 09-03-2025 21-03-2025 02-04-2025 14-04-2025 26-04-2025 08-05-2025 20-05-2025 01-06-2025 13-06-2025 25-06-2025 07-07-2025 19-07-2025 31-07-2025 12-08-2025 24-08-2025 05-09-2025 17-09-2025 29-09-2025 11-10-2025 23-10-2025 04-11-2025 16-11-2025 28-11-2025 10-12-2025 22-12-2025 03-01-2026 15-01-2026 20-01-2026
Downloads
Growth
Peak

Upgrade to Pro

Unlock 30-day, 90-day, and yearly download history charts with a Pro subscription.

Upgrade Now

Reviews & Ratings

4.8
48 reviews
Overall 96%
5
45 (94%)
4
0 (0%)
3
2 (4%)
2
0 (0%)
1
1 (2%)

Tracked Keywords

Showing 2 of 2
Keyword Position Change Type Updated
contact form 7 module 110 Tag 11 hours ago
contact form 7 extension 137 Tag 11 hours ago

Unlock Keyword Analytics

Track keyword rankings, search positions, and discover new ranking opportunities with a Pro subscription.

  • Full keyword position tracking
  • Historical ranking data
  • Competitor keyword analysis
Upgrade to Pro

Track This Plugin

Get detailed analytics, keyword tracking, and position alerts delivered to your inbox.

Start Tracking Free

Plugin Details

Version
6.1.0
Last Updated
May 02, 2024
Requires WP
4.7+
Tested Up To
6.4
PHP Version
5.6 or higher
Author
Aurovrata V.

Support & Rating

Rating
★ ★ ★ ★ ★ 4.8
Reviews
48
Support Threads
0
Resolved
0%

Keywords

Upgrade to Pro

Unlock keyword rankings, search positions, and detailed analytics with a Pro subscription.

Upgrade Now

Frequently Asked Questions

Common questions about Post My CF7 Form

add_filter('cf7_2_post_form_append_output', 'redirect_on_submit', 10, 3);
function redirect_on_submit($script, $attr, $nonce){
//$attr cf7 shortcode attributes to check if this is the correct form.
$url = site_url('/submitted'); //page slug to redirect to.
$url = add_query_arg( array('cf72post' => $nonce,), $url);
$url = esc_url($url);
$script .= '<script>'.PHP_EOL;
$script .= 'document.addEventListener( "wpcf7mailsent", function( event ) {'.PHP_EOL;
$script .= ' var save = document.getElementsByClassName("cf7_2_post_draft");'.PHP_EOL;
$script .= ' if(save.length == 0 || "false" === save[0].value){'.PHP_EOL;
$script .= ' location = "'.$url.'";'.PHP_EOL;
$script .= ' }'.PHP_EOL;
$script .= '}, false );'.PHP_EOL;
$script .= '</script>'.PHP_EOL;
return $script;
}
Now the submitted form is saved to a post and its ID is stored in a transient field by the plugin. You can access this transient field with the following code in your page template,

if(isset($_GET['cf72post'])){
$post_id = get_transient($_GET['cf72post']);
echo 'form submission saved to post:'.$post_id;
}

If you wish to redirect to the newly saved post (assuming it is published, see FAQ #16),
if(isset($_GET['cf72post'])){
$post_id = get_transient($_GET['cf72post']);
//get the link to the new post,
$url = get_permalink($post_id);
if ( wp_redirect( $url, 200 ) ) {
exit;
}
echo 'unable to redirect, maybe the post wasn't published';
}
2. map a form to a post?
In the Contact Form 7 table list you will notice a new column has been added which allows you to create a new custom post mapping. This will take you to a new screen where you will see your existing fields listed in select dropdowns. Map your form fields to either a default field (eg title, content, excerpt, or author), or create a custom (meta) field, or even create a new taxonomy for your post. Once you have mapped your form you can toggle its status from on to off. In the off position, the plugin will no longer capture form submissions and save them to the mapped post.
3. I made a mistake in my form mapping, how do I correct it once it is created?
You can simply modify the mapping at any given time, however if a mapping has been live and saving submissions to your post, then it is not recommended to make changes. Unless you have a fair understanding of WordPress posts and meta-fields structures and how these are saved in the database, I highly recommend that you delete any existing posts that may have been saved from form submissions that used the previous mappings. Failing to do this without a proper understanding of the changes you are making to an existing mapping with previously saved post submissions could lead to difficult errors to debug and fix once you start creating post submissions that have a different mapping. Consider yourself warned!
4. How do remove a mapping?
Simply toggle the status to off.
5. How do I map a field to a taxonomy ?
You create a new taxonomy and map your field to it. Note however that only select/checkbox/radio type of fields can be mapped to taxonomies. Once mapped and published you will see your taxonomy appear in your custom post menu. You can add terms to your taxonomy and these will be made pre-filled into your mapped field. Users can select a term and when the form is submitted, the post will be created with those terms assigned to it. (see screenshot 9 for more details.)
6. How do I create non-hierarchical taxonomies ?
You need to use a special filter for this, 'cf7_2_post_filter_taxonomy_registration-{$taxonomy_slug}', see the Filter & Actions section for more details.
7. Why filter the taxonomy mapping ?
You may have noticed that in addition to mapping a post field or taxonomy to one of your form fields, you can also use a filter to hook your own custom values. In the case of taxonomies, you can actually map a form submission to a specific set of terms depending on the submission of other fields.
8. How do I allow my form users to create a new term for a taxonomy?
This is a little more complex. You will need to create an input field in your form in which users can submit a new term. You will then need to hook the action cf7_2_post_form_mapped_to_{$post_type} which is fired right at the end of the saving process. The hook parses the newly created $post_ID as well as the submitted $cf7_form_data form data array. You can then check if your user has submitted a new value and include it in taxonomy and assign the new term to the post.
9. How can I pre-fill a form's field values ?
There are are 2 filters provided to achieve this. In both cases, these filters are fired if the form is mapped to a post type only. The default behaviour is for the plugin to seek any draft saved form values for teh current user. A form is saved (draft) if the save button tag is used which allows a user to save a partially filled form and to submit it at a later stage. If a draft form is found for the current user, then the first filter will not be fired,

the cf7_2_post_filter_cf7_field_value is fired for each field, and a helper code is available in the mapping edit admin page (see the Screenshot #8), filter #7.
cf7_2_post_form_values is fired at the end of values pre-fill process, and allows all the values to be filtered, including those that may have been loaded if the current user as a draft form saved.

add_filter('cf7_2_post_form_values', 'simple_cf7_form_values' ,10,4);
function simple_cf7_form_values($field_values, $cf7_id, $post_type, $ck7_key){
if( 'my-form'!=$ck7_key ) return $field_values; //check this is the correct form.
$field_values['your-name'] = 'prefilled name';
return $field_values;
}

If you have a WordPress page template that contains a CF7 form and want to change the field values from one page request to another, this can be done using the cf7_2_post_form_values filter (see Filter & Actions for more details). You will need to create an anonymous function on this filter and pass the CF7 id form your shortcode which you can automatically scan for form your page content. In the example below I assume that the page contains the default 'Contact Me' CF7 form which I want to pre-fill if a user is logged in,

$content = get_the_content();
//let's find our shortcode
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches );
$args = array();
if( isset( $matches[2] ) ){
foreach( (array) $matches[2] as $key => $shortcode ){
if( 'contact-form-7' === $shortcode )
$args[] = shortcode_parse_atts( $matches[3][$key] );
}
}
//here I am assuming there is a single form on the page, if you have multiple, you will need to loop though each one
if(!empty($args) && isset($args[0]['id'])){
$short_id = $args[0]['id'];
$values = array();

if(is_user_logged_in()){
$user = wp_get_current_user();
$values['your-name']= $user->display_name;
$values['your-email'] = $user->user_email;
if(!empty($subject)){
$term = get_term_by('id', $subject, 'project-type');
$values['your-message'] = 'Dear Hexagon,'.PHP_EOL.'I request you to create a new '.rtrim($term->name,'s') ;

}
//now lets filter the values
add_filter('cf7_2_post_form_values', function($field_values, $cf7_id) use ($short_id, $values){
if($short_id == $cf7_id ){
return $values;
}
}, 10,2);
}
}

10. How to use custom JavaScript script on the form front-end ?
The plugin fires a number of jQuery scripts in order to map saved submissions back to draft forms. So if you need to customise some additional functionality on your form on $(document).ready(), then you need to make sure it fires after the plugin's scripts have finished. In order to achieve this, the script fires a custom event on the form, the form id built using a nonce to ensure the event is unique to the form (in case you have multiple forms on the same page), which you can use to ensure you script fires in the right order, here is how you would enable this,

add_filter('cf7_2_post_form_append_output', 'append_my_script', 10, 4);
function append_my_script($output, $attr, $nonce, $cf7form_key){
if(!isset($attr['id'])){
return $output;
}
$cf7_id = $attr['id'];
if(19 == $cf7_id){ //check this is your form
$output .= '<script type="text/javascript">';
$output .= '(function( $ ) {';
$output .= ' //fire your script once the form nonce event is triggered';
$output .= ' $(document).on("'.$nonce.'", $("div#'.$nonce.' form.wpcf7-form"), function() {';
$output .= ' var cf7Form = $("div#'.$nonce.' form.wpcf7-form");';
$output .= ' ... //your custom scripting';
$output .= '});';
$output .= '})( jQuery );';
$output .= '</script>';
}
return $output;
}

NOTE: the plugin wraps your form with a <div/> element whose id is the event nonce iteself. So if you prefer to enqueue your js file on the page instead of appending it, simply query the element $('div.cf7_2_post') and extract its id attribute to bind the event.
11. Is it possible to save my form to an existing post type?
yes, but you need to know how to use WordPress hooks in your functions.php file in order to get it to work. If you map your form, you now have a dropdown to select the type of post to which you want to save it to. When you select 'Existing Post' from the option, instructions will show up on screen to map your form.
12. I am saving my form to an existing post, can I pre-load taxonomy terms in my form?
Sure you can, again you need to use the hooks cf7_2_post_map_extra_taxonomy & cf7_2_post_pre_load-{$post_type} to get it to work, see the example in the section Filter & Actions.
13. Is there any advanced documentation for developers ?
sure, there is a section Filter & Actions which lists all the hooks (filters & actions) available for developers with examples of how to use them. These expose a lot of the default functionality for further fine-tuning. If you see a scope for improvement and/or come across a bug, please report it in the support forum.
14. Is it possible to have multiple forms submitted from a single page ?
yes, as of v1.4 of this plugin you can now have multiple saved/draft submissions on a single page. To get it to work you need to track which forms are mapped to which post yourself. Introduce a hidden variable in your form to store your mapped post ids. For example you have a custom post which maps/stores submitted faults reported by your users. On page load, you need to pass the mapped post id to this plugin via your cf7 shortcode by dynamically calling the shortcode using do_shortcode and the attribute cf7_2_post_id,

$args = array(
'post_type' => 'fault-post',
'post_status'=> 'any',
'author' => get_current_user_id()
);
$faults = get_posts($args);
foreach($faults as $post){
$cf7_attr = ' cf7_2_post_id="'.$post->ID.'"';
//display your form, you might want to add some more html to structure to display them as tabs or something else.
echo do_shortcode('[cf7form key="user-fault" title="Faults" '.$cf7_attr.']');
wp_reset_postdata();
}
//if you need to add an extra empty form, then ensure you pass the cf7_2_post_id attribute as -1
//$cf7_attr = ' cf7_2_post_id="-1"';
//echo do_shortcode('[cf7form key="user-fault" title="Faults" '.$cf7_attr.']');

15. I have enabled a save button on my form, but draft submissions are not being validated!
This is the default functionality for saving draft submissions. This is especially useful for a very large forms which users may take several visits to your site to complete. Email notifications of draft submissions are also disabled. If you wish to override this, you may do with the filters cf7_2_post_draft_skips_validation & cf7_2_post_draft_skips_mail examples of which are given in the documentation Filters & Actions below.
16. How do I publish posts automatically on form submission ?
The default behaviour is to save post to 'draft' status. If you wish to change this, you can use the filter 'cf7_2_post_status_{$post_type}' and return a valid post status. See the Filters & Hooks section of this documentation for more information.
17. How do I make custom posts publicly visible on the front-end ?
the default configuration of the plugin mapped custom posts are only visible in the dashboard. This a security feature. If you want your posts to be visible on the front-end, then you need to change the registration attributes. See this screenshot for the posts settings you need to enable or disable for making your posts public as well as query-able on the front-end.

If you have created a custom taxonomy for your post, you can include these into your main menu by enabling them in the Appearance->Menu screen options dropdown of your Dashboard.
18. I mapped some fields to post meta-fields, why can't I see them in the dashboard?
When you map your form fields to the custom post meta fields, you need to to ensure that these meta-fields are displayed in the post edit page of your dashboard using meta-boxes. You can custom create these meta-boxes in your functions.php file or you can also use a plugin. However, without these metaboxes you won't be able to see your field values when you edit your posts.
19. Why does my form page have no-cache metas ?
As of v3.0.0 the no-cache metas have been added by default to pages with embedded forms that are being mapped by this plugin. Note this does not affect pages with forms which are not mapped. This is done to ensure that forms with pre-loaded field values (saved draft forms or forms with pre-filled values) are not being cached by the browser and as a result load spurious values.

If your form is not being saved by users and not being pre-filled, then you may decide to disable the no-cache metas with the following filter,

add_filter('cf7_2_post_print_page_nocache_metas', '__return_false'));

It is not possible to target pages with specific forms.
20. How can I reload forms already submitted?
Once a form is submitted the _cf7_2_post_form_submitted meta-field is updated (from 'no' to 'yes') in the post to which the form was saved. As of v3.3.0 a metabox is introduced in the post admin page which allows an administrator to toggle the status back to 'no' and therefore allow your user to re-load the form with the submitted values (same functionality as a saved draft form).
21. How can I filter the terms of a mapped taxonomy field ?
Use the filer provided in the filter & actions helper metabox of the mapping page in the dashboard (see screenshot 8). Use the filter terms list (#4 in the section Form Loading Hooks),
22. Can I map deeper levels of my hierarchical taxonomy to a select2 field?
As of v3.8, 2 new hooks have been introduced to allow you to custom map your taxonomy terms to form fields that use a JavaScript plugin to allow users to select terms which are nested deeper than the default parent-child setup provide by this plugin. An example of such a js plugin is the Select2 extension, Select2-to-tree. This plugin requires the select options to have specific classes and attributes to be set (see the documentation). To achieve this, here is an example of code you can place in your functions.php,

add_filter('cf7_2_post_filter_cf7_taxonomy_select_optgroup', 'turn_off_grouping', 10, 5);
function turn_off_grouping($isGrouped, $cf7_post_id, $field, $term, $cf7_key){
if('my-contact-from' == $cf7_key && 'your-country' == $field){
$isGrouped = false;
}
return $isGrouped;
}
//switch off select2 that is loaded & initialised by this plugin.
add_filter('cf7_2_post_filter_cf7_taxonomy_select2', 'turn_off_select2', 10, 4);
function turn_off_select2($useSelect2, $cf7_post_id, $field, $cf7_key){
if('my-contact-from' == $cf7_key && 'your-country' == $field){
$useSelect2 = false;
}
return $useSelect2;
}
//enqueue your own select2/select2-to-tree libraries.
add_action('cf72post_form_printed_to_screen', 'enqueue_libraries');
function enqueue_libraries($cf7_key){
//wp_enqueue_script(...);
}
//add extra classes.
add_filter('cf72post_filter_taxonomy_term_class', 'add_custom_classes_to_options', 10, 5);
function add_custom_classes_to_options($classes, $term, $level, $field, $cf7_key){
if('my-contact-from' == $cf7_key && 'your-country' == $field){
$classes[] = 'l'.(level+1);
}
return $classes;
}
//add extra attributes.
add_filter('cf72post_filter_taxonomy_term_attributes', 'add_custom_attributes_to_options', 10, 5);
function add_custom_attributes_to_options($attributes, $term, $level, $field, $cf7_key){
if('my-contact-from' == $cf7_key && 'your-country' == $field){
if($level>0){
$attributes['data-pup'] = $term->parent;
}
}
return $attributes;
}

You will also need to initialise your select2 field,

var $mappedForm = $('div.cf7_2_post form.wpcf7-form');
var eventID = $mappedForm.closest('div.cf7_2_post').attr('id');
//initialise once the form has been loaded by the plugin.
$mappedForm.on(eventID, function(){
$('.your-country select').select2ToTree();
});

23.Can a previously submitted post be reloaded into a form programmatically?
yes, this is possible. You have to know a few things first,

A mapped post that has been saved as a draft is reloaded automatically for the same author/logged in user.
A submitted post, as opposed to a saved/draft one, has a its meta-field _cf7_2_post_form_submitted set to ‘yes’, and this controls whether or not an author's post is to be reloaded when the form is being displayed for the current user.

However, you can override all this by actually hooking into the post loading process prior to displaying the form. The process used get_posts to retrieve a post, and takes the first post it finds.

add_filter('cf7_2_post_filter_user_draft_form_query', 'custom_post_query',10,3);
function custom_post_query($query_args, $post_type, $cf7key){
if('my-form' === $cf7key){ //check for your mapped form unique key.
//set up your custom $query_args
}
return $query_args;
}

24. How do I add a link to newly saved post in the confirmation mail?
Use the mail tag [cf7_2_post-edit] and [cf7_2_post-permalink] to add a link to the editable post in the admin dashboard and the post permalink in the front-end respectively.
25. When deleting a mapping, how do I delete all submitted posts data ?
Hook the following filter in your functions.php file prior to deleting the mapping for that post_type.

add-filter('cf7_2_post_delete_submitted_posts', 'delete_posted_data',10,3);
function delete_posted_data($delete_data, $post_type,$form_key){
//you may filter by form_key and/or post_type....
$delete_data = true;
return $delete_data;
}

26. Save draft button is auto-styled, how to custom style it?
The save button is automatically styled (with inline style script) to be the inverse colours of the submit button as well as having a 1px wide border. The border line style is set using rules included in the CSS stylesheet and can be overridden with custom CSS.
The auto-styling of the colour and background colour can also be overridden or altogether switched off with the following filter in your functions.php file,

add_filter('c2p_autostyle_save_button', '__return_false');

the filter also passes the form key, should you want to distinguish between forms.
27. How can I customise the intialisation of a Select2 field?
If you want to load your own intialisation script to customise the select2 dropdown then you need to use the filter below to stop the plugin from using the default initialisation. Please read the FAQ 10 on how to load custom scripts to make sure you trigger your script after the form is mapped.

add_filter( 'cf7_2_post_filter_cf7_delay_select2_launch', '__return_true');

28. ACF plugin file meta-field is not recognised/saved properly
A number of users have complained that when mapping a form submission to a custom post/meta-fields created by the ACF plugin (or other similar plugins), the file form field is not saved in a format that allows the ACF plugin to identify the file. By default the Post My CF7 Form plugin saves uploaded files to the wp uploads folder and inserts them into the Media section as a post attachment, it then saves the url of the file to the meta-field. The ACF plugin and other similar plugins that automatically create these meta-fields do not recognise the URL value and expects another storage format (possibly the file attachment post ID). You can remedy this issue by using the following filter and change the format your plugin expects. If you are not sure what format that is, then please consult the plugin documentation that you are using and get the right format.

add_filter('cf7_2_post_metafield_file', 'change_meta_field_file_format', 10, 6);
function change_meta_field_file_format( $file_format, $attachment_id, $post_id, $post_field, $form_field, $cf7_key ){
/*
* $file_format, default format is url path.
* $attachment_id, file media attachment post id.
* $post_id, form submission mapped to post.
* $post_field, the meta post fields being saved.
* $form_field, the form field from which it was submitted.
* $cf7_key the current form being mapped.
*/
$file_format = .... //set the expected format.
return $file_format;
}

29. Testing mapping of published forms
As of v5.7.0 you now have more control over the ability to save a submission from a form accessible to the public. If you are developing your website and not concerned about who has access to it, then simply switch your form mapping to live (see screenshot #11). However, if you are looking to map a form that is already accessible to the public on a live site, then you can test your mapping by leaving it the default draft mode and use the following filter to allow only certain users's submission to be saved to the mapped post,

// this filter is only fired when a form mapping is in draft mode.
add_filter( 'cf7_2_post_save_draft_mapping', 'save_submitted_forms', 10, 2);
function save_submitted_forms($allow, $cf7_key){
if('my-mapped-form' === $cf7_key){
if( 1 === get_current_user_id() ) $allow = true; // if current user is the admin, save the submission.
}
return $allow;
}

Sign In / Register

You need to sign in or register to use this feature.