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.

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 Form Statistics

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