From the Codex for pre_get_posts:
pre_get_posts cannot be used to alter the query for Page requests (page templates) because ‘is_page’, ‘is_singular’, ‘pagename’ and other properties (depending if pretty permalinks are used) are already set by the parse_query() method. See: Query Overview. The recommended way to alter the main query for page requests is to use new WP_Query in the page template itself.
So, I’d suggest seeing if new WP_Query ( http://codex.wordpress.org/Class_Reference/WP_Query ) could help you here.
Related Posts:
- How to filter, restrict and return posts based on custom user meta information
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- WordPress tax_query “and” operator not functioning as desired
- Custom taxonomy query broken after upgrade to 4.4
- Show posts without term
- How to add taxonomy filter on the query fly?
- ajax category filter
- Display posts the match taxonomy term linked from wp_list_categoies?
- WordPress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given
- Query two taxonomies via URL or link?
- Pagination custom query
- Order by two meta keys
- Counting number of posts with Category B in Category A
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Custom archive page based on array of categories and tags
- Function to check if author has posted within the last x days
- Select posts wich has no relationship in custom taxonomy
- Shortcode returns escaped HTML tags
- Calling a custom excerpt function in a local loop
- How to get any tag ID
- List taxonomy terms plus their latest post ordered by post date
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Dynamically Override Fancy Title – Part II
- query posts in functions.php and update a field
- Filter and list posts of a custom taxonomy
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- WP Query using tax_query & meta_query
- Show posts from a custom taxonomy on a page
- WP_Query ignoring tax_query when is_singular
- Having trouble with WooCommerce Storefront child theme single.php “related posts” modification [closed]
- wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
- How do I exclude the lowest level terms in a taxonomy?
- wp_query for multiple cities (multiple values in a metabox)
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Display most popular in the past two days
- Query with relation and one without relation using multiple taxonomies?
- How to display an other custom post type in a different custom post type’s archive?
- Search form not working with custom query?
- meta_query not working as expected
- Post loop for all taxonomy terms
- Display custom tags on pages that have a specific page parent
- New WP_Query calls Pre_get_posts filter twice
- wp_query args adding muitiple tax_querys
- how to access query string in wordpress?
- find posts that don’t have a custom taxonomy
- Custom taxonomy.php not working
- Merge two search functions for custom post type
- Filter Custom Taxonomy Posts
- WP_Query args to show posts from specific custom taxonomy
- WP_Query for a taxonomy with different taxonomy types
- Make a SQL query with wpdb in WordPress
- get all posts associated with a custom taxonomy
- How to set an alternate posts_per_page value for default queries in different templates
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- Using custom taxonomies in a query
- Error with function in functions.php?
- How to add custom meta to ‘pre_get_terms’?
- Tax Query only returns for the first of several terms
- Can’t fetch Custom Post Type Data through Custom Query
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Exclude authors IDs from WP_Query
- Loading two different AJAX requests on two different pages
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- WP_Query returns different results from get_posts() [closed]
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- How to load a script code only in posts?
- How to print term name inside wp post loop
- Multiple meta_key ordering with pre_get_posts
- Check if a post has term inside loop
- How do I fit WP_Query arguments into a function?
- Create a notification for post field
- Add URL Rewrite Rule To WordPress
- How to get posts by category and by choosing a taxonomy term?
- How to restrict search on a certain page to only return results against custom taxonomies?
- Query Taxonomy By Page Title
- Trying to get property of non-object in: $wp_query
- WordPress dynamic AJAX query
- Custom Taxonomy Breaks Pages
- relation OR instead of AND – Filtered term ID’s in loop
- Foreach loop returning more than one item when querying taxonomy
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Why is my pagination /page/2 taking me to index.php?
- Variations as Single Products [closed]
- Custom Taxonomy in custom REST API search
- I’m trying to get posts under a custom taxonomy but I don’t know what I’m doing wrong here
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Display Featured image from custom post type category (custom taxonomy) wise
- Excluding a category from frontpage but not from WP_Query
- Adding a language rule and displaying posts with a custom taxonomy term on its archive page
- WP_Query on custom taxonomy -> Location and Activity
- Filter on one post type with taxonimy and get other post type
- Include custom post type that matches taxonomy field in another custom post type
- Showing all posts of the current custom taxonomy on archive page
- Include posts with a specific custom taxonomy term in author page
- wp query order posts by custom taxonomy doesn’t work correctly
- has_term not returning anything