Scheduled posting not working

You don’t need that line in wp-config.php as wp-cron is enabled by default. If you install the Cron View plugin you are able to see when the different jobs are scheduled. You can then trigger wp-cron manually by going to this URL with your browser: http://your-domain.com/wp-cron.php?doing_wp_cron If after this the actions you expected where successfully … Read more

Create function in functions.php with hook name to execute URL

AS said by Fleuv you can use wp_schedule_event() function to execute your code like this add_action(‘my_twfours_action’, ‘my_twfours_action_fn’); my_twfours_action_fn (){ //this code will execute every 24 hours } wp_schedule_event( time(), ‘daily’, ‘my_twfours_action’ ); //adding new cron schedule event To create your 2 minutes filter and then scheduling a cron jo is like function my_two_minutes_filter( $schedules ) … Read more

Run a php file daily at specific time

You can include the PHP file and do the tasks, if WP-cron is your only option. // Scheduled Action Hook function run_my_script( ) { require_once(‘related/path/to/php/file.php’); } // Schedule Cron Job Event function USERS_MONITORING() { if ( ! wp_next_scheduled( ‘USERS_MONITORING’ ) ) { wp_schedule_event( strtotime(’07:00:00′), ‘daily’, ‘USERS_MONITORING’ ); } } add_action( ‘USERS_MONITORING’, ‘run_my_script’ ); Note that … Read more

Wp cron event is set but the function isn’t getting fired

I needed the hook name and not the function name so instead of this: if ( ! wp_next_scheduled( ‘do_this_in_an_hour’ ) ) { wp_schedule_single_event( time() + 40, ‘do_this_in_an_hour’ ); } That: if ( ! wp_next_scheduled( ‘my_new_event’ ) ) { wp_schedule_single_event( time() + 40, ‘my_new_event’ ); }