How To Delete Submission Records Using MySQL

  • Modifying database records yourself using MySQL is done at your own risk.
  • We are not responsible for any data loss as a result of the use of any SQL on this page.
  • We are unable to provide support for this method of deleting records.
  • Submission data deleted using this method cannot be recovered.
  • Always create a backup of your database before making changes.

Tables

WS Form submissions are stored in the following database tables:

  • [table prefix]wsf_submit
  • [table prefix]wsf_submit_meta

The default table prefix is wp_ but you should check your table prefix before proceeding.

Example SQL

The example SQL below can be used to bulk delete submission records in WS Form. This example assumes your table prefixes are ‘wp_’. You should double check your table prefix before running this SQL.

/* Delete submission records */
DELETE FROM wp_wsf_submit WHERE form_id = 123 AND date_added < '2021-06-23 18:57:37';

/* Delete orphaned submit meta records */
DELETE wp_wsf_submit_meta FROM wp_wsf_submit_meta LEFT OUTER JOIN wp_wsf_submit ON wp_wsf_submit_meta.parent_id = wp_wsf_submit.id WHERE wp_wsf_submit.id IS NULL;

In this example there are two WHERE conditions you should change:

  • form_id = 123
    Change this to match the form ID you wish to delete submissions from.
  • date_added < '2021-06-23 18:57:37'
    This determines the date up to which submissions are deleted. You can also omit this part of the clause if you wish to delete ALL submissions.

Resetting the Submit ID

Once you have deleted the submission records you can reset the submit ID back to 1 by using the following SQL:

ALTER TABLE wp_wsf_submit AUTO_INCREMENT = 1

Resetting Form Statistics

If you wish to reset the statistics for a form, this can be done under Global Settings in the Data tab.

Note that form statistics only increment when a form is viewed publicly. Previewing a form does not impact statistics.