WordPress Cron: Running as which user?

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()

Related posts

Leave a Reply

2 comments

  1. I’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.