How to use wp_schedule_event in a class?

Add an action outside your class definition: add_action(‘my_unique_plugin_event_hook’, array($this,’hook’)); And then use this in your event: wp_schedule_event(time(), ‘daily’, ‘my_unique_plugin_event_hook’);

Schedule WordPress Auto-Updates to only run during business hours

This one is actually surprisingly simple; add this to your wp-config.php file and all automatic updates will be blocked when outside of the specified hours: // Suspend updates when outside of business hours, 9:00 AM to 5:30 PM $updates_suspended = (date(‘Hi’) < 0900 || date(‘Hi’) > 1730); define( ‘AUTOMATIC_UPDATER_DISABLED’, $updates_suspended ); You can also use … Read more

Using wp_schedule_single_event with arguments to send email

I think you have mismatch in how you pass arguments and how you expect it to work. You pass array of arguments to schedule and expect your hooked function to receive identical array of arguments. This is not the case. Cron events are processed by do_action_ref_array(), which in turn passes arguments via call_user_func_array(). So your … Read more

WordPress cron isn’t scheduled on amazon web services

As a general principal, you shouldn’t do anything that requires an ‘add_action’ after the plugin activation hook. This is because WP loads and runs all plugins and THEN runs the new added one, and then does a re-direct. You have to set a DB option and hook into that. Here is the discussion from the … Read more

Is there a known vulnerability for wp-cron.php?

In wp-includes/default-filters.php we can find a callback registration: // WP Cron if ( !defined( ‘DOING_CRON’ ) ) add_action( ‘init’, ‘wp_cron’ ); If we go the function wp_cron() now, we see this: $schedules = wp_get_schedules(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) break; foreach ( (array) $cronhooks as … Read more

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