Just found this to work to exclude the frontpage !$query->get( 'page_id' ) == get_option( 'page_on_front' )
thanks to this
seems kind of “hack-y,” but it works.
to exclude the nav-menu query $query->query_vars['post_type'] != 'nav_menu_item'
Thank you everyone for your help.
Related Posts:
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- pre_get_posts filter meta_query without conflicting existing meta_query
- pre_get_posts order by not working
- Single meta_query query using OR instead of AND in request’s WHERE statement
- Using meta_query with multiple keys and compare values
- Help ordering Post loop by two meta values
- Order ascending is ignored in meta query?
- Multiple meta_key ordering with pre_get_posts
- Sorting search results with custom dropdown
- meta_query is overriding default search
- Pre get posts sort by meta key returns no results if meta key does not exist
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- When to use WP_query(), query_posts() and pre_get_posts
- Meta_query compare operator explanation
- meta_query with meta values as serialize arrays
- Should I use Pre Get Posts or WP_Query
- Nested meta_query with multiple relation keys
- Using pre_get_posts with WP_Query
- meta_query ‘compare’ => ‘IN’ not working
- Use REGEXP in WP_Query meta_query key
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- WP Query Args – Title or Meta Value
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- How to query posts based on lat-lng coordinate as post meta?
- how to show posts that are missing a meta_value
- What is “main query”? [duplicate]
- Set Alias for meta_query arguments in get_posts()
- Sorting: custom query with orderby meta_value_num THEN by title
- Display products from specific category in shop page
- Reduce or prevent calling of update_meta_cache
- How to add taxonomy filter on the query fly?
- How to Compare Two Meta Fields
- Does tax_query really beats meta_query in all situations?
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- How to uniquely identify queries?
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Order Search Results Page by meta_value If no Value Return Remaining Results
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Getting attachments by meta value
- Query Multiple Post types each with own meta query
- pre_get_posts with get_posts
- How-to exclude terms from the main query the most performant way?
- Changing Posts Per Page and offset with pre_get_posts
- Execute a large WP_Query with many “AND” Meta_Queries?
- Query all posts where meta value is empty
- WP_Query min and max values
- Slow SQL_CALC_FOUND_ROWS Query
- “pre_get_posts” firing on every query
- RSS feed with specific keyword
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Using custom meta_query with relation not working as expected
- Perform query with meta_value date
- Using is_main_query to select custom post type on certain page
- querying with custom meta field with meta_query
- Order by two meta keys
- multiple meta key but get server load is very high
- Meta Query with date and time on the same Day before given time
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- Multiple orderby parameters in pre_get_posts() action
- How to grab metabox value in wp_query meta_query key
- WP_Query meta_query where meta value ends in space
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Nested query inside Logical operator OR not working in meta_query
- SQL Statement generated by WP_Query not producing expected results
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- Query by meta_key and order by meta_value_num return orderby date
- What is an efficient way to query based on post_meta?
- WP_Query not working as expected for attachments and custom meta_query
- datetime picker, timestamps and meta queries
- How do I create my own nested meta_query using posts_where / posts_join?
- Sorting Posts by custom field
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Query with pre_get_posts to get pagination
- Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
- Recommended way to drop a pending query (in pre_get_posts)?
- Wp_query order by multiple custom fields?
- Single page theme that uses pages for the content
- How can I create a WP_Query that returns posts where one meta_value
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
- WordPress altering my custom query, How to fix it?
- WP Meta Query for some meta (array) values
- Can’t sort order of wp_query with 2 meta keys
- Exclude post on loop by multiple meta key value
- Sort users by meta_value_num
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- meta_query with array as value
- WordPress custom search form with pre_get_posts not work
- If orderby parameter using pre_get_posts is the same for multiple posts what fallback does the query use?
- Can not switch the queried post in pre_get_posts hook
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Order by meta_key in custom post type doesn’t affect the query