my name is frank, i have been trying to create a cronjob that will be deleting a database table every 12 midnight but i found no help, below is the database table. please any help?

DELETE FROM X51g_myCRED_log WHERE ref = 'link_click'

The sql command for dropping a table would be something like:


That would drop (delete) the table 'X51g_myCRED_log'.

You can accomplish this with WP CLI:

wp db query "DROP TABLE IF EXISTS X51g_myCRED_log".

Be careful, I havent tested this, but this should point you in the right direction

  • Yea thank you very much, but please I want to make it to be deleting the logs every 12 midnight – Onyeka Franklin Oct 16 '20 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.