EDIT: Just noticed this seems to work on every page but the frontpage to exclude the nav menu $query->query_vars['post_type'] != 'nav_menu_item'
Would there be any reason that the function has access to the query_vars being passed to WP_Query on every page except the front page? Only frontpage is throwing this error:
<b>Notice</b>: Undefined property: WP_Query::$post in <b>...wp-includes/query.php</b> on line <b>3034</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3402</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3404</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3406</b><br />
<br />
<b>Notice</b>: Undefined property: WP_Query::$post in <b>...wp-includes/query.php</b> on line <b>3034</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3402</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3404</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>...wp-includes/query.php</b> on line <b>3406</b><br />
<br />
<b>Notice</b>: Undefined index: post_type in <b>...lib/custom.php</b> on line <b>1051</b>
and lastly,...sadly,...is_main_query()
just won't work. (we found ourselves in some sticky situations that required some secondary queries.)