Run a Change Role Cron Job on WordPress via cPanel

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

Add cron schedule to upload video on save_post

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

Call a PHP file from Cronjob

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

WP_CRON issue with UTC and local time

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

Most efficient way to trigger wp-cron through system cron.

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)