Wordpress PHP Cron jobs

admin

Administrator
Staff member
I have a plugin that imports csv data into wordpress tables. It runs through the Wordpress dashboard where you input some details and click a button to execute it.

I've altered the plugin so that the input data is static(from the same csv every time) and is now all located in one php file. I want to schedule a Cron job to execute this script every hour or so.

I tried to set it up using cPanel and directly accessing the php file but it does not work(nothing is displayed). I believe this is because the plugin uses wordpress functions such as wp_insert_post.

How can i run this script, as if it were run through wordpress dashboard, as a scheduled event?

Note: the file also contains some javascript.