Try use get_query_var instead of $_GET and also increase priority
function my_pre_get_posts( $wp_query ) {
// do not modify queries in the admin
if( is_admin() ) {
return $wp_query;
}
// allow the url to alter the query
if( isset(get_query_var( 'budget' )) ) {
$wp_query->set('meta_key', 'budget');
$wp_query->set('meta_value', get_query_var( 'budget' ));
}
// return
return $wp_query;
}
add_action('pre_get_posts', 'my_pre_get_posts', 11);
Related Posts:
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Sorting: custom query with orderby meta_value_num THEN by title
- How to get order of posts?
- Meta query with order by another custom field
- How do I sort posts with multiple pages
- Sort wordpress custom posts based on meta value
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Understanding the orderby in WP_Query?
- Help ordering Post loop by two meta values
- orderby ignored by wp_query
- How to sort store location by specific category order in WP store locations
- How to sort wordpress posts already selected by WP_QUERY
- WP Query with meta queries
- Order 2 meta_queries differently in WP_Query?
- Display three sequential posts on each page load, without repeating previous
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Order by optional meta key?
- Order posts by ID in the given order
- Sorting posts by custom date fields (non standard date format)
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- WP Query orderby meta key natural sort?
- WP_Query sort by comment meta data
- Order posts by tags count?
- Merge 2 args in one WP_Query and order it by date
- Orderby = none not working [duplicate]
- WP_query ‘orderby=none’ Problem
- Revolution Slider Orderby Two Custom Fields
- Sorting meta_value as integer doesn’t work
- Sort in WP_Query(), not filter? Is it possible?
- Front End Sorting Questions
- Woocommerce custom loop to show all the products [closed]
- How to sort posts in admin by titles with dd.mm.yyyy format?
- Ordering by meta_value AND date NOT WORKING with wp_query
- WP_Query orderby breaks when using AJAX?
- Custom Post order for homepage
- Change default ordering of taxonomy terms – pre_get_terms
- WP_Query Order by Specific Post ID First
- Sorting posts DESC based on the number of comments using WP_Query
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- Combining sorted and random CPT
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Orderby ASC changes to DESC in WP_Query
- How to set multiple `orderby` in query argument?
- WordPress Comments sort by custom meta key
- Order by summing multiple values
- Order by empty custom field
- Advanced ordering of query_posts
- How to sort a custom wordpress query by combination of meta values?
- how to get post order by post id wp_query?
- Ordering posts by an array
- How to Create a Random List of Child Pages
- I am having problem sorting custom post type using WP_Query
- Specify strict ‘order by’ in WordPress query
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- Display all posts in a custom post type, grouped by a custom taxonomy. How to sort the posts alphabetically and the terms by ID?
- WP Query and date format
- How order posts from category by date and comment count?
- Child pages not affected by orderby
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- Sorting posts by Multiple custom fields in defined order
- WP_Query orderby random do not repeat infinite scroll – one loop
- How to sort queried pages by an array of page ids?
- Sort posts using multiple custom fields and menu_order in single query?
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- Order (by ASC) posts with meta_key so posts without values are last
- How can I order a post query’s results based on the number of matching taxonomy terms?
- how to include orderby value that is empty?
- Custom WP Query order function possible?
- How sort products by calculate value? ( custom post meta, price, option)
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Meta query orderby meta_value_num sorting by role first
- Order posts by tags count?
- Order Element By Custom Field in WordPress
- Wp Query sort order from custom MetaBox
- Case insensitive ORDERBY in wpquery
- Sorting with meta_query and multiple, optional meta keys
- How to mix two orderby-parameters into one ordered result
- WP_Query: custom orderby (not ASC nor DESC)
- Sorting Posts by Taxonomy thats not within the query’s $args
- Order & Orderby clause not working with custom query
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Query All Attachments and Order by Parent Publish Date
- Using orderby with 2 meta keys
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Custom query to order by multiple taxonomies
- Query category-specific, paginated posts and allow viewer to change sort order
- Get post closest to today
- Posts2Posts, wp_query and orderby issue
- Order by meta values
- Change posts archive ordering
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- orderby and order filter in get_posts or WP_query function in wordpress not working
- Why does wp_query only display the most recent post when using order ASC?
- new WP_Query with order args – no more distinction between categories