How to add a cron job in my functions.php
How to add a cron job in my functions.php
How to add a cron job in my functions.php
New database entry to trigger runing PHP/SQL query through link with token, without logging into the website
Run external file cron using WordPress Scheduler
unix cronjob for wordpress does not stop running
Managed to find the solution. My finished code is: register_activation_hook ( __FILE__, ‘cron_job’ ); function cron_job() { wp_schedule_event( time(), ‘hourly’, ‘hourly_job’ ); } add_action( ‘hourly_job’, ‘cron_job_task’ ); function cron_job_task () { $users = get_users( array( ‘fields’ => array( ‘ID’, ‘user_registered’ ), ‘role’ => ‘coaching’, ) ); foreach ( $users as $user ) { $time = … Read more
You’re not specifying the number of posts you want back from the query, so it defaults to whatever you have set under Settings > Reading. If you want all that match your criteria, then add ‘posts_per_page’ => -1 to your query arguments.
I think the best approach would be to only save a post meta value ( [or use a custom table][1] ) which indicates that a video upload should happen. Also register a schedule that will query for all posts that are marked as “upload needed” and do the upload in the schedule execution. https://gist.github.com/EdwardBock/85c971633ea1abf8f248f4fb468344ed You … Read more
Your best option is probably to first explore your current hosting environment for the possibilities of Cronjobs. It might be called “Scheduled Tasks” or similar. Alternatively you can schedule a task from within WordPress via wp_schedule_event() (though if you’re using the default WP Cron, you can’t be certain of it running at the specified time) … Read more
It seems you are comparing GMT time with the local time before you update the user meta. Try WP function current_time( $type, $gmt = 0 ); $current_time = current_time(‘timestamp’, 0) // local time $current_time = current_time(‘timestamp’, 1) // GMT time I think you need $current_time = current_time(‘timestamp’, 0) // local time instead of $current_time = … Read more
The official wordpress documentation https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/ suggests doing it via a web request rather as per your first example rather than php CLI as per your second example. Their example uses wget, but your curl request would work just as well. I believe they are using the web request replicates the standard http requests that would … Read more