Is there a way to execute a WordPress action/hook from a server-side CRON job?

I'm not talking about WordPress cron tasks...

有帮助吗?

解决方案

Typically you schedule an event (action/hook) using:

wp_schedule_event($timestamp, $recurrence, $hook, $args);

Then to execute it using a server-side CRON , you would load WordPress's wp-cron.php.

This can be problematic because WP has it's own internal (not-real) Cron, so it's best to disable it completely using define(‘DISABLE_WP_CRON’, true); to avoid conflicts.

There are lots of articles on this you can read by searching for "Replacing WordPress cron" or "Using real cron with WordPress", so you know what you're in for (for example you can also lock the cron).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top