Skip to content

Instantly share code, notes, and snippets.

@danielpowney
Last active October 26, 2017 23:32
Show Gist options
  • Save danielpowney/a14179d7427735e806e1e5b89707543d to your computer and use it in GitHub Desktop.
Save danielpowney/a14179d7427735e806e1e5b89707543d to your computer and use it in GitHub Desktop.
<?php
/**
* If pretty permalinks are turned on, we need to make the following query string variables
* available to WP_Query to sort by highest rated posts
*/
function my_query_vars( $qvars ) {
$qvars[] = 'orderby';
$qvars[] = 'meta_key';
$qvars[] = 'order';
$qvars[] = 'ignore_sticky_posts';
return $qvars;
}
add_filter( 'query_vars', 'my_query_vars' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment