I accidentally deleted a Contact Form 7 form and needed to restore it. I didn't want to rebuild it from scratch, so I spent a day trying to fix it. I finally found a solution that worked. This should be a last resort, and I'm not responsible for the consequences. Proceed with caution, and don't say I didn't warn you!
However, these steps did work for me, so I'm sharing them in case they help you too.
At first you may think it is no big deal to rebuild a contact form, but this one was complicated. This form was a 4 step application using Contact Form 7 – Dynamic Text Extension and Contact Form 7 Multi-Step Forms that took 3 days to build, then "poof", deleted it by accident. Doing a site restore to a previous date before I deleted it did not work, so I thought I was out of luck.
Thinking it was gone forever and would have to create another one, I gave it one last shot and did a little research to see if/how I could restore it, though I could not find a real solution. Digging a bit and putting all that information together, eventually it was restored.
However, as I pointed out already I'm not an expert in Contact Form 7, so I may have made some mistakes in the steps I outlined below. If you see anything that could be improved, please feel free to leave a comment below.
Here is how I restored a deleted form from Contact Form 7.
The directions below are for BlueHost, but regardless of who you are hosting your website with, the cPanel should look similar. Also, if you are not backing up your website on your host, this will not work for you. as in this case, we were using Site Back Up Pro.
I am also using ManageWP. If you are using the free back up that they offer, you could also use that as well. Bottom line is you will need a back-up.
So, whatever you are using to back up your website, you will want to be able to access your database files. That is because the old form that was deleted is not located in your website files, they are located in the tables that are located in your SQL database.
The form data of Contact Form 7 are stored in the wp_posts table under wpcf7_contact_form post_type.
IMPORTANT: You want to be sure that you are using the same version of Contact Form 7. If you deleted the form you want to restore and Contact Form 7 has been updated, you will want to revert to the older version before you update your SQL database.
The instructions for both are below using Site Back Up Pro (not ManageWP). If you understand the instructions below, you should be able to make it work using Filezilla.
Restoring Contact Form 7 to Previous Version
Chances are, you may not need to do this initial step, but if it has been several days or weeks since you deleted your form, you will want to go back to the version of Contact Form 7 that you were using when you deleted the from. If you know do not have to restore to a previous version, then go to Restore the Deleted Contact Form .
STEP 1: Login to your cPanel and choose Site Back Up Pro from your options.
STEP 2: Choose Website Files -> Browse. From there, (if you have more than 1 website, be sure to be in the right website folder) navigate (by clicking): wp-content -> plugins.
STEP 3: Check the box to the left of the folder named 'contact-form-7', and then click 'restore'.
Note: If you are unsure what database goes with your website, you can locate it from your file manager. Select the website folder, then select view on the wp-config.php file. Scroll till you see the line with the database name, in 'define('DB_NAME', 'xxxxxx_xxxx');
This may take a few minutes, but at the top of the page it will tell you the status. After the restore has been completed, continue to the next steps below.
Restore the Deleted Contact Form into Contact Form 7
STEP 1: From your cPanel, go to your Site Back-up Pro as explained in Step 1 above.
STEP 2: Click the browse link under MySQL'
STEP 3: Select your data base (left check in image below) and then click on 'restore tables'.
STEP 4: Select the 'wp_cf7dbplugin_st' table and then click the "restore tables' button.
Allow the tables to restore completely and then go back to your websites Contact Form 7 forms and you should see the form you deleted.
And that is how I recovered a deleted contact form for Contact Form 7, this worked for me.
About the Author:
The SEO-Alien is a project started in 2009 regarding all things online marketing. The site started out more of a diary of predictions, suggestions and references to things I frequently used for online marketing... before social media marketing was even an option.
I hope you find the information and tools presented here useful and something worth sharing with others.
If there is anything else about online marketing or any online advertising strategy you think would be helpful, please let me know.