Automatic delete entries by day, hours, minute etc...

Est. Reading: 1 minute
Created: 07/25/2017
Category:
Difficulty: Intermediate

Automatic delete entries by day, hours, minute etc...

×Warning: This tutorial was created 2676 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

This only work on Linux server, or you can use same idea on Windows Server.

  1. Connecting via SSH to your server
  2. Create sql file on your server nano drop_Formidable_entries.sql and save it on any location that you want. exp: /home/Formidable
  3. Insert example the following queries inside the sql file:
    use wordpress;
    DELETE FROM wp_frm_items WHERE form_id=x and created_at < (NOW() - INTERVAL 1 MINUTE);

    wordpress: it's database name.
    wp_frm_items: it's table name
    form_id=x: input form id that you wanted delete entries from it.
    1 MINUTE: in this case will delete all entries from form id x older than 1 minute. You can change it into HOUR, DAY, WEEK or etc. For more value click here

  4. Save it
  5. In command line type crontab -e to add cron job into system, with following command.
    */30 * * * * /usr/bin/mysql < /home/Formidable/drop_Formidable_entries.sql >/dev/null 2>&1
    Here */30 mean every 30 minutes will delete entries. You can change it as you want. For crontab generator click here

    NB: If you have cPanel or Plesk you can simple create file and cron job inside cPanel or Plesk control panel. It's easy as command line.

Leave a Reply

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crosschevron-leftchevron-rightarrow-right