Title: WP_Query modification while on cron context
Last modified: August 21, 2016

---

# WP_Query modification while on cron context

 *  [Stefano Lissa](https://wordpress.org/support/users/satollo/)
 * (@satollo)
 * [13 years ago](https://wordpress.org/support/topic/wp_query-modification-while-on-cron-context/)
 * Actually it seems the WP_Query internally set the “is_home” to true when a get_posts()
   is called (the get_posts() function not the internal method) in the cron context.
 * That is a problem since plugins that change the main query believed they are 
   in the home rendering context.
 * The WP_Query actually set the is_home to false is we are in the administration
   context, this is how I discovered the problem.
 * I think it should be added a check on the DOING_CRON so the post extraction in
   a cron fired event is considered like an administrative context (or at least 
   not the home context).
 * Stefano Lissa.

The topic ‘WP_Query modification while on cron context’ is closed to new replies.

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [Stefano Lissa](https://wordpress.org/support/users/satollo/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/wp_query-modification-while-on-cron-context/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
