Tag Info

New answers tagged

1

You shouldn't call wp_clear_scheduled_hook on every page load, because then you're always restarting your wp-cron shcedule, with your current setup. Additionally this call: wp_clear_scheduled_hook( 'le_do_this' ); doesn't make any difference, since le_do_this isn't a hook name in your setup. You could try for example this test plugin: <?php /** * ...


1

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) ...


0

I was having the same issue recently, until I followed an example from the Wordpress Codex which suggests using action hooks to run the function. I think if you add the following... add_action( 'recalculate_all_scores_hook', 'recalculate_all_scores' ); ...and amend the wp_schedule_event function to use the action hook name rather than the function ...


0

So your constructor is probably not being executed before the cron event is being run. If your instantiating the fb_linter class too late then your call to add_action won't happen in time. Try using the singleton design pattern for your class and then instantiate it right after you declare it and it should work just fine. something like class fb_linter { ...


0

I think the best way is to use WP-CLI but you'd need to write a bash script to do this. Here is one that should do it for you: WP_PATH="/path/to/wp" for SITE_URL in = $(wp site list --fields=domain,path,archived,deleted --format=csv --path="$WP_PATH" | grep ",0,0$" | awk -F ',' '{print $1 $2}') do for EVENT_HOOK in $(wp cron event list --format=csv ...


0

I've had this problem before. What is happening (from the looks of it) is that you are setting up the action hook to be scheduled, but failing to make use of it. e.g. function update_feeds($ids = false, $timing = false) { do something } wp_schedule_event( time(), 'everyhour', 'scheduled_update_feeds' ); In addition to this, you would need something ...



Top 50 recent answers are included