سؤال

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