Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('pre_get_posts', 'my_pre_get_posts');
- function my_pre_get_posts( $query )
- {
- // validate
- if( is_admin() )
- {
- return $query;
- }
- // allow the url to alter the query
- // eg: http://www.website.com/event/?event_season=winter
- if( isset($_GET['event_season']) )
- {
- $query->set('meta_key', 'event_season');
- $query->set('meta_value', $_GET['event_season']);
- }
- // always return
- return $query;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement