I’m writing a plugin. It has some job to be execute by wp_cron. Now within the script, it create/edit some posts automatically. So which user will be running the cron job?
Also I notice it failed when calling WP_Filesystem()
I’m writing a plugin. It has some job to be execute by wp_cron. Now within the script, it create/edit some posts automatically. So which user will be running the cron job?
Also I notice it failed when calling WP_Filesystem()
You must be logged in to post a comment.
Well I’ve found out that it’s running as no one, as
get_current_user_id()
returns 0I’ve been doing some debugging today and I’ve found that
get_current_user_id()
is often, but not always,0
(logged out). The cron can get triggered by any user and your code should anticipate that.