Avoiding “_wpcf7” Fields
February 10th, 2012
For Contact Form 7 Users: a recent update of the Contact Form 7 plugin seems to have added several new meta fields to form submissions. These automatically get saved by the CFDB plugin. If you look on the Database page in your administration panel, you will see extra fields associated with new submissions:
_wpcf7,_wpcf7_version,_wpcf7_unit_tag,_wpnonce,_wpcf7_is_ajax_call
You may view these fields as unwanted clutter.
To avoid saving these fields, go to the Database Options page, and paste the list of fields in the following:
Update
Since regular expressions can now be used in this field, you can achieve the same effect but putting in this:
/.*wpcf7.*/,_wpnonce
Categories: tips, troubleshooting
Hello,
I tried your solution but fields are always present.
I connected in my database to delete them in the hand, and I do not manage at all to delete them: it on guard one of every.
How do I have to make?
Thank you for your help
I should clarify that when this solution is put in place, new form submissions will not have the fields but those already in the DB still have it. You will have to delete the old entries in the DB to not see the column in the admin page. If you purchased the editor extension, you can just delete the column. If not, you need to go into your DB and execute
delete from wp_cf7dbplugin_submits where field_name like ‘_wpcf7%’
This returns an SQL message
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘%’’ at line 1
@Ernestas
I think that is the web site theme formatting the single quotes into different ones. In that SQL use the single quote that is straight up-and-down, not slanted or curly ones like shown.
Thank you Michael ! It worked now.
Worked for me too; would have found this easier if I had read the “Uncategorized” category; read the rest looking for this hint. (Maybe tickle this as a tip or troubleshooting?)
Hi Michael
As well as the extra “clutter” fields you detail in your post, I have an additional 2 fields that turned up after the recent Contact Form 7 updates, namely: “capcode” (a very long string related to the CAPTCHA I have on my forms), and “s_s_c_loader” (there’s no data being saved in this field, perhaps it is related to a different CAPTCHA implementation?).
I presume I can safely elect to also not save these fields into the database (and delete the existing columns)?
Thanks
Gillian
Yes.
Hi Michael,
I’m new to PHP so please bear with me.
I’d like to remove all the unnecessary wpcf7 columns but I don’t know in which exact file I’ll need to add this line
delete from wp_cf7dbplugin_submits where field_name like ‘_wpcf7%’
Could you please tell me the name of the file? I’m using Contact Form to DB Extension.
Also is there a way to reposition columns/cells around? I clarify:
I have made a survey with Contact Form 7 (not sure that was the best way but it worked) and in this form there is a field for a name and there are 36 questions.
When I check the results in the wordpress admin, database section everything appears on one row.
I would like to have a name per column and an answer per row, so that the result is a grid.
Is that possible? If yes, what is the file that needs to be amended?
I hope I’ve been clear enough.
Looking forward to a reply,
Many thanks
Jeff
On the “delete” statement, you don’t add it to a file. You have to figure out how to get access to your database using PHPMyAdmin (check with your hosting provider) and execute the statement.
>When I check the results in the wordpress admin, database section everything appears on one row.
Each form submission will be in its own row, forming a grid.
>I would like to have a name per column and an answer per row, so that the result is a grid.
You can’t customize the grid in the admin page, but when displaying the results on a page you can use a short code and use its options to customize how it looks. Refer to the cfdb-html short code where you essentially define an HTML template for how you want it to look.
@Michael Simpson
Thank you so much for the reply Michael, I got everything working.
How To avoid saving “upload” file di Database & send To email Only?
There is no way to turn this off entirely. But using the “Do not save fields in DB named” setting you might explicitly indicate upload fields to not save.