$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Where in the page load code is wp-cron triggered?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Where in the page load code is wp-cron triggered?

matteradmin8PV0评论

I just spent way too much time trying to troubleshoot why my wp-cron job wasn't running. It seems, under 4.9.8, the only way to run cron is by calling the wp-cron.php file as a URL.

The docs say though, that it should run on page loads, though I can't locate where. Any help, please?

I just spent way too much time trying to troubleshoot why my wp-cron job wasn't running. It seems, under 4.9.8, the only way to run cron is by calling the wp-cron.php file as a URL.

The docs say though, that it should run on page loads, though I can't locate where. Any help, please?

Share Improve this question asked Dec 7, 2018 at 8:56 DrazisilDrazisil 1034 bronze badges 2
  • 1 Do you have DISABLE_WP_CRON defined in wp-config? – Krzysiek Dróżdż Commented Dec 7, 2018 at 9:02
  • I do not, at least not in any way I can locate. – Drazisil Commented Dec 7, 2018 at 12:44
Add a comment  | 

1 Answer 1

Reset to default 2

The WordPress cron is run by the wp_cron() function, which is hooked to run on the init hook, which runs on every page load.

wp_cron() is defined in wp-includes/cron.php and hooked in wp-includes/default-filters.php.

The wp_cron() function kicks off a wp_remote_post() request to /wp-cron.php. Some server configurations prevent scripts sending a request to the same domain like this however, so as an alternative you can set the ALTERNATE_WP_CRON constant to true. When enabled this redirects the user to the current URL but with ?doing_wp_cron= added to the URL, instead of the post request.

Post a comment

comment list (0)

  1. No comments so far