You can’t alter a page query via pre_get_posts (in any fashion I’ve tried) to something other than a page query. If you look at the generated SQL, it’s trying to query all your post types for a pagename of new. If you set pagename to null, it’ll return posts, but it will disregard any taxonomy parameters you try to set.
Even if you could successfully alter the query, it would no longer be a page and wouldn’t load a page template.
I think the simplest way to handle this is to just create a new query in your template via WP_Query.
Related Posts:
- Custom query filter not working on woocommerce category page
- $query->query_var[‘post_type’] not set for pages
- Filter query posts by the count of metas for a meta key
- How to set back query var author_name after unset it?
- Change searched term
- pre_get_posts : ‘post__not_in’ doesn’t work with global variable
- How to change the amount of posts previewed on a page?
- How to reset usual $query on search page to push custom $wpdb query there?
- Merge CPT Taxonomy and Post Taxonomy in $query->set
- custom sorting media with multiple filters – error: not unique table/alias: wp_postmeta
- New custom post type entries are not sorted correctly in admin using pre_get_posts
- Limiting a filtered query
- Why the pre_get_posts hook can cause apache stopped working?
- excludeCat function reverses order of blog posts
- Run search query again without pagination gives no results?
- Set posts per page for parent category and it’s all children
- Modify a query using both a text field and a true/false AFC field
- Admin Post List table Query filtering “WHERE” for custom post type
- pre get posts not working with Tribe Events
- How to get comments by post ID?
- Create pagination and order according to alphabet
- How to display Section for certain time
- Why does get_the_time(‘F j’) return November 30 for all posts?
- Query set using tax_query with relation ‘OR’ modifies category object?
- When add_query_arg() is necessary?
- Insert html after certain amount of posts?
- wp remove query
- $wpdb->get_var not returning a result
- $args numberposts variable
- Save default value for empty or missing post meta
- Listing posts by grouping dates
- $wpdb->query() vs. $wpdb->get_results() vs. phpMyAdmin
- How to display all posts with today’s same month and day only?
- How to mass delete one line from all posts after site hack
- Query posts by content lenght
- $wpdb doesn’t appear to work on page inside of a plugin
- Show featured image as background image from postQuery
- Using $wpdb->update but confused on the WHERE in and SET
- How to export current year posts from WordPress?
- Search query -> Show all pages except certain template
- Style Post Differently In Query
- How do I see the mysql query generated by get_posts( $args )?
- is_search called incorreclty
- Function to delete a post, it’s children and it’s grand children (half way there already)
- Multiple Category Query
- list all categories that have a certain word in title
- Passing parameters to a static front page
- wp_list_pages() refuses to output posts
- Where is the query in wp-login.php
- Can’t seem to do combined query AND sort?
- Order posts by recent comments
- query if page has not child
- sort query results by newest
- pre_get_posts : only get posts by wp_usermeta value
- Order by meta value pro first then meta value free in my search function
- Custom Query returns array, but I can’t see it’s elements
- How to delete all posts, categories and tags from WordPress database
- Ideas how to search & replace post_content when string contains a newline?
- How to insert Collate into WordPress search query?
- Combine “Exclude” Query in functions.php
- Query the WordPress database to get data together with replaced information
- $wpdb->prepare affecting the query?
- WordPress SQL search, how to handle SQL Injection?
- Optimize slow SQL query for multiple meta values
- prepare function sql safe method
- Query for Custom Post Type UI Does Not Loop All the Post
- Updating with $qpdb->query() always returns 0 rows affected
- How to manage a particular “order by” for get_search_query()?
- Query to view scheduled or draft post
- How to return count of custom post type posts with a specific custom field value via $wpdb?
- How to add a Variable to post query
- Exclude taxonomy Query if post_type
- Sort a list of a CPT ( job) if a meta is empty
- pre_user_query vs pre_get_posts
- Restore WordPress Backup Locally?
- Trouble migrating custom post types from non-wordpress cms
- “order” does not affect order of custom query
- Create a new post on a specified publish date via link?
- Exclude Posts from a Widget
- Query String for the WP_QUERY parameters
- $wpdb query for price in custom field value
- Add generic page to WP_Query
- Advanced Custom Fields Query with Different Values of the Same Key
- No results for taxonomy archive page
- Multiple terms not working on taxonomy
- Sorting of coupons in the right way
- Get query result before posts are displayed?
- Custom post types loop on a page template
- WP_Query older new links navigation?
- How to get one result using wpdb class?
- SQL Query : how copy all tags of post into their post content in wordpress by sql query
- Delete query won’t run
- Pre_get_post on CPT archive page
- Ascending & descending posts on same page with IF statement
- Prevent executing query for wp_global_styles
- Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155
- is it possible to get a list of URLs from post_content directly in a mysql query via phpadmin?
- Get URL parameters with rewrite rules
- is_search called incorrectly
- Trying to Add Paging to Single Post Page