I have to run a custom PHP script which I want to run by a cron job. Within that script, I need wordpress functions to insert users into WordPress table. My script is on the root directory of the wordpress installation. My script is starting with:
require( dirname( __FILE__ ) . '/wp-load.php' );
If I run the script directly in the browser then my functions and everything else works with no errors. But when the cron hits it apparently does not work. Nothing that is supposed to happen happens.
Just for if it helps, my command line is:
php -q /home/enkaizene/public_html/soporte/cron-test.php
Is the issue the script? or the command? How should my script start?
Thank you
You could run the cron using wget to the web address.
You will be limited by php timeout so you will need to make sure the script doesn’t run longer than your set timeout – or increase the timeout.