質問

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