Upgrade to 3.8 breaking is_main_query() function
-
I’m using the “pre_get_posts” hook to modify the WordPress query for 2 specific categories on a site. Everything is working fine until it gets to this point:
if($query->is_main_query()) { $query->query_vars['post__in'] = $pageposts_arr; $query->query_vars['orderby'] = 'post__in'; }
$pageposts_arr is just an array of post IDs in a specific order determined by a special mysql query. I’ve tried both $query->is_main_query() and is_main_query(), neither return any value. Everything works fine if I remove the if test, except that it breaks all the other queries on the page. I can confirm that it was working fine in 3.7, and broke immediately upon upgrading to 3.8.
Been searching for quite a while, but noone else seems to be having this problem. Anyone know what’s up?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Upgrade to 3.8 breaking is_main_query() function’ is closed to new replies.